Commit 115c2d67 authored by nanahira's avatar nanahira

use roles

parent 6f8416a5
--- ---
- hosts: docker - hosts: docker
remote_user: root remote_user: root
tasks: roles:
- name: docker - name: docker
include: includes/docker.yml
{
"official_database": "./ygopro/cards.cdb",
"pre_release_database": "./../ygopro-pre-data/expansions/pre-release.cdb"
}
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
- hosts: hypervisor - hosts: hypervisor
remote_user: root remote_user: root
tasks: tasks:
- name: authorized_key
authorized_key:
user: "{{ ansible_user_id }}"
key: "{{ webvirt_ssh_key }}"
- name: apt - name: apt
become: true become: true
when: "ansible_distribution != 'CentOS'" when: "ansible_distribution != 'CentOS'"
......
---
- hosts: docker
remote_user: root
tasks:
- name: docker
include: includes/docker.yml
...@@ -2,14 +2,16 @@ ...@@ -2,14 +2,16 @@
- hosts: srvpro - hosts: srvpro
remote_user: root remote_user: root
vars: vars:
nodejs_version: 12
# home_path: ~ # home_path: ~
# fork: mycard # fork: mycard
tasks: # server_type: public
roles:
- name: nodejs - name: nodejs
include: includes/nodejs.yml vars:
nodejs_version: 12
- name: mono - name: mono
include: includes/mono.yml when: 'server_type != "tournament"'
tasks:
- name: apt - name: apt
become: true become: true
apt: apt:
...@@ -43,6 +45,14 @@ ...@@ -43,6 +45,14 @@
state: latest state: latest
name: curl,wget,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,redis,p7zip,p7zip-plugins,tar,unzip name: curl,wget,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,redis,p7zip,p7zip-plugins,tar,unzip
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8" when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: pre data
git:
repo: 'https://git.dev.tencent.com/mercury233/ygopro-pre-data.git'
dest: '{{home_path}}/ygopro-pre-data'
version: master
force: true
accept_hostkey: true
track_submodules: true
- name: ygopro - name: ygopro
git: git:
repo: 'https://github.com/{{fork}}/ygopro' repo: 'https://github.com/{{fork}}/ygopro'
...@@ -83,20 +93,24 @@ ...@@ -83,20 +93,24 @@
force: true force: true
accept_hostkey: true accept_hostkey: true
track_submodules: true track_submodules: true
when: 'server_type != "tournament"'
- name: build windbot - name: build windbot
shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5 shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5
args: args:
chdir: '{{home_path}}/windbot' chdir: '{{home_path}}/windbot'
when: 'server_type != "tournament"'
- name: link windbot.exe - name: link windbot.exe
file: file:
state: link state: link
src: './bin/Release/WindBot.exe' src: './bin/Release/WindBot.exe'
path: '{{home_path}}/windbot/WindBot.exe' path: '{{home_path}}/windbot/WindBot.exe'
when: 'server_type != "tournament"'
- name: link cards.cdb - name: link cards.cdb
file: file:
state: link state: link
src: '{{home_path}}/ygopro/cards.cdb' src: '{{home_path}}/ygopro/cards.cdb'
path: '{{home_path}}/windbot/cards.cdb' path: '{{home_path}}/windbot/cards.cdb'
when: 'server_type != "tournament"'
- name: srvpro - name: srvpro
git: git:
repo: 'https://github.com/{{fork}}/srvpro' repo: 'https://github.com/{{fork}}/srvpro'
...@@ -135,6 +149,7 @@ ...@@ -135,6 +149,7 @@
state: link state: link
src: '../windbot' src: '../windbot'
path: '{{home_path}}/ygopro-server/windbot' path: '{{home_path}}/ygopro-server/windbot'
when: 'server_type != "tournament"'
- name: directories - name: directories
file: file:
state: directory state: directory
...@@ -145,12 +160,29 @@ ...@@ -145,12 +160,29 @@
- ygopro-server/replays - ygopro-server/replays
- ygopro-server/logs - ygopro-server/logs
- ygopro-server/config - ygopro-server/config
- ygopro-server/plugins
- name: pre compat plugin
git:
repo: 'https://github.com/purerosefallen/srvpro-pre-compat'
dest: '{{home_path}}/ygopro-server/plugins/srvpro-pre-compat'
version: master
force: true
accept_hostkey: true
track_submodules: true
- name: pre compat npm
npm:
path: '{{home_path}}/ygopro-server/plugins/srvpro-pre-compat'
registry: https://registry.npm.taobao.org
- name: pre compat config
copy:
src: files/srvpro/pre-compat-config.json
dest: '{{home_path}}/ygopro-server/plugins/srvpro-pre-compat/config.json'
- name: stop firewalld - name: stop firewalld
become: true become: true
systemd: systemd:
name: firewalld name: firewalld
state: stopped state: stopped
when: "ansible_distribution == 'CentOS'" when: "ansible_distribution == 'CentOS'"
- name: redis - name: redis
become: true become: true
systemd: systemd:
......
--- ---
- hosts: wg_install - hosts: wg_install
remote_user: root remote_user: root
tasks: roles:
- name: wireguard - name: wireguard
include: includes/wireguard.yml
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
- hosts: pter - hosts: pter
remote_user: root remote_user: root
vars: vars:
nodejs_version: 10
pter_release: v0.6.12 pter_release: v0.6.12
tasks: roles:
- name: nodejs - name: nodejs
include: includes/nodejs.yml vars:
nodejs_version: 10
- name: docker - name: docker
include: includes/docker.yml tasks:
- name: apt - name: apt
apt: apt:
update_cache: true update_cache: true
......
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for docker
---
# handlers file for docker
\ No newline at end of file
galaxy_info:
author: Nanahira
description: Docker
company: MyCard
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
---
- hosts: localhost
remote_user: root
roles:
- docker
\ No newline at end of file
---
# vars file for docker
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for mono
\ No newline at end of file
---
# handlers file for mono
\ No newline at end of file
galaxy_info:
author: Nanahira
description: Node JS
company: MyCard
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
---
- hosts: localhost
remote_user: root
roles:
- mono
\ No newline at end of file
---
# vars file for mono
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
nodejs_version: 12
---
# handlers file for nodejs
\ No newline at end of file
galaxy_info:
author: Nanahira
description: Node JS
company: MyCard
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
---
- hosts: localhost
remote_user: root
roles:
- nodejs
\ No newline at end of file
---
# vars file for nodejs
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for wireguard
\ No newline at end of file
---
# handlers file for wireguard
\ No newline at end of file
galaxy_info:
author: Nanahira
description: WireGuard
company: MyCard
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
---
- hosts: localhost
remote_user: root
roles:
- wireguard
\ No newline at end of file
---
# vars file for wireguard
\ No newline at end of file
...@@ -177,6 +177,11 @@ ...@@ -177,6 +177,11 @@
line: 'HOSTNAME=localhost.localdomain' line: 'HOSTNAME=localhost.localdomain'
insertafter: 'EOF' insertafter: 'EOF'
when: "ansible_distribution == 'CentOS'" when: "ansible_distribution == 'CentOS'"
- name: ssh-keygen service
become: true
copy:
content: |
- name: clean logs and hostkeys - name: clean logs and hostkeys
become: true become: true
shell: 'rm -rf /etc/ssh/ssh_host_* /var/log/*' shell: 'rm -rf /etc/ssh/ssh_host_* /var/log/*'
......
...@@ -6,6 +6,14 @@ ...@@ -6,6 +6,14 @@
# fork: mycard # fork: mycard
backup_name: '{{lookup("pipe","date +%m.%d")}}' backup_name: '{{lookup("pipe","date +%m.%d")}}'
tasks: tasks:
- name: pre data
git:
repo: 'https://git.dev.tencent.com/mercury233/ygopro-pre-data.git'
dest: '{{home_path}}/ygopro-pre-data'
version: master
force: true
accept_hostkey: true
track_submodules: true
- name: srvpro - name: srvpro
git: git:
repo: 'https://github.com/{{fork}}/srvpro' repo: 'https://github.com/{{fork}}/srvpro'
...@@ -28,10 +36,12 @@ ...@@ -28,10 +36,12 @@
force: true force: true
accept_hostkey: true accept_hostkey: true
track_submodules: true track_submodules: true
when: 'server_type != "tournament"'
- name: build windbot - name: build windbot
shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5 shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5
args: args:
chdir: '{{home_path}}/windbot' chdir: '{{home_path}}/windbot'
when: 'server_type != "tournament"'
- name: remove deprecated ygopro-new - name: remove deprecated ygopro-new
file: file:
path: '{{home_path}}/ygopro-new' path: '{{home_path}}/ygopro-new'
......
--- ---
- hosts: utility - hosts: utility
remote_user: root remote_user: root
tasks: roles:
- name: docker - name: docker
include: includes/docker.yml
static: false
when: "ansible_distribution != 'Fedora'" when: "ansible_distribution != 'Fedora'"
tasks:
- name: utility directory - name: utility directory
file: file:
path: /root/utility path: /root/utility
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment