Commit 7a7e869b authored by nanahira's avatar nanahira

srvpro

parent ab9064b3
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
- hosts: srvpro - hosts: srvpro
remote_user: root remote_user: root
vars: vars:
install: true
# home_path: ~ # home_path: ~
# fork: mycard # fork: mycard
# server_type: public # server_type: public
roles: roles:
- name: nodejs - name: nodejs
vars: vars:
nodejs_version: 14 nodejs_version: 16
- name: mono - name: mono
when: 'server_type != "tournament"' when: server_type is not defined or server_type != "tournament"
tasks: tasks:
- name: apt - name: apt
become: true become: true
...@@ -40,133 +41,12 @@ ...@@ -40,133 +41,12 @@
dnf: dnf:
name: curl,wget,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,p7zip,p7zip-plugins,tar,unzip name: curl,wget,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,p7zip,p7zip-plugins,tar,unzip
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 8 when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 8
#- name: lua from source
# include_tasks: tasks/lua-from-source.yml
# when: ansible_os_family != 'Debian'
- name: pre data
git:
repo: 'https://e.coding.net/mercury233/ygopro-pre-data.git'
dest: '{{home_path}}/ygopro-pre-data'
force: true
accept_hostkey: true
track_submodules: true
- name: ygopro - name: ygopro
git: include_tasks: ./tasks/srvpro/ygopro.yml
repo: 'https://code.mycard.moe/{{fork}}/ygopro' vars:
dest: '{{home_path}}/ygopro' ygopro_path: '{{home_path}}/ygopro'
version: '{{ygopro_branch}}' - name: common
force: true include_tasks: ./tasks/srvpro/common.yml
accept_hostkey: true
track_submodules: true
- name: premake5
unarchive:
src: https://cdn01.moecube.com/ygopro-build-materials/premake-5.0.0-beta1-linux.tar.gz
dest: '{{home_path}}/ygopro/'
creates: '{{home_path}}/ygopro/premake5'
remote_src: true
- name: download lua
unarchive:
src: https://cdn01.moecube.com/ygopro-build-materials/lua-5.3.6.tar.gz
dest: /tmp/
creates: /tmp/lua-5.3.6
remote_src: true
when: ansible_os_family != 'Debian'
- name: move lua
shell: 'cp -rf /tmp/lua-5.3.6 {{home_path}}/ygopro/lua ; cp -rf {{home_path}}/ygopro/premake/lua/premake5.lua {{home_path}}/ygopro/lua/'
args:
creates: '{{home_path}}/ygopro/lua/premake4.lua'
when: ansible_os_family != 'Debian'
- name: debian params
set_fact:
premake_params: '{{premake_params}} --lua-deb'
- name: premake5 gmake
shell: './premake5 gmake {{premake_params}}'
args:
chdir: '{{home_path}}/ygopro'
- name: build
make:
chdir: '{{home_path}}/ygopro/build'
target: "config=release"
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro
shell: strip bin/release/ygopro
ignore_errors: true
args:
chdir: '{{home_path}}/ygopro'
- name: link ygopro
file:
state: link
src: './bin/release/ygopro'
path: '{{home_path}}/ygopro/ygopro'
- name: windbot
git:
repo: 'https://code.mycard.moe/{{fork}}/windbot'
dest: '{{home_path}}/windbot'
version: '{{windbot_branch}}'
force: true
accept_hostkey: true
track_submodules: true
when: 'server_type != "tournament"'
- name: build windbot
shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5
args:
chdir: '{{home_path}}/windbot'
when: 'server_type != "tournament"'
- name: link windbot.exe
file:
state: link
src: './bin/Release/WindBot.exe'
path: '{{home_path}}/windbot/WindBot.exe'
when: 'server_type != "tournament"'
- name: link cards.cdb
file:
state: link
src: '{{home_path}}/ygopro/cards.cdb'
path: '{{home_path}}/windbot/cards.cdb'
when: 'server_type != "tournament"'
- name: srvpro
git:
repo: 'https://code.mycard.moe/{{fork}}/srvpro'
dest: '{{home_path}}/ygopro-server'
version: '{{srvpro_branch}}'
force: true
accept_hostkey: true
track_submodules: true
- name: fixup npm
become: true
file:
path: ~/.npm
owner: '{{ansible_user_id}}'
group: '{{ansible_user_id}}'
recurse: true
when: ansible_user_id != 'root'
- name: srvpro npm
npm:
path: '{{home_path}}/ygopro-server'
ci: true
- name: link ygopro repo
file:
state: link
src: '../ygopro'
path: '{{home_path}}/ygopro-server/ygopro'
- name: link windbot repo
file:
state: link
src: '../windbot'
path: '{{home_path}}/ygopro-server/windbot'
when: 'server_type != "tournament"'
- name: directories
file:
state: directory
path: '{{ home_path }}/{{ item }}'
with_items:
- ygopro/replay
- ygopro-server/decks
- ygopro-server/replays
- ygopro-server/logs
- ygopro-server/config
- ygopro-server/plugins
- name: stop firewalld - name: stop firewalld
become: true become: true
ignore_errors: true ignore_errors: true
......
- name: pre data
git:
repo: 'https://e.coding.net/mercury233/ygopro-pre-data.git'
dest: '{{home_path}}/ygopro-pre-data'
force: true
accept_hostkey: true
track_submodules: true
- name: windbot
include_tasks: ./windbot.yml
when: server_type is not defined or server_type != "tournament"
- name: set default srvpro_fork
set_fact:
srvpro_fork: '{{fork}}'
when: srvpro_fork is not defined
- name: set default srvpro_branch
set_fact:
srvpro_branch: master
when: srvpro_branch is not defined
- name: srvpro
git:
repo: 'https://code.mycard.moe/{{srvpro_fork}}/srvpro'
dest: '{{home_path}}/ygopro-server'
version: '{{srvpro_branch}}'
force: true
accept_hostkey: true
track_submodules: true
register: srvpro_result
- name: srvpro npm
npm:
path: '{{home_path}}/ygopro-server'
ci: '{{install}}'
when: srvpro_result.changed or install
- name: link ygopro repo
file:
state: link
src: '../ygopro'
path: '{{home_path}}/ygopro-server/ygopro'
- name: link windbot repo
file:
state: link
src: '../windbot'
path: '{{home_path}}/ygopro-server/windbot'
when: server_type is not defined or server_type != "tournament"
- name: srvpro directories
file:
state: directory
path: '{{ home_path }}/ygopro-server/{{ item }}'
with_items:
- ygopro-server/decks
- ygopro-server/replays
- ygopro-server/logs
- ygopro-server/config
- ygopro-server/plugins
- name: set default windbot fork
set_fact:
windbot_fork: '{{fork}}'
when: windbot_fork is not defined
- name: set default windbot branch
set_fact:
windbot_branch: master
when: windbot_branch is not defined
- name: windbot
git:
repo: 'https://code.mycard.moe/{{windbot_fork}}/windbot'
dest: '{{home_path}}/windbot'
version: '{{windbot_branch}}'
force: true
accept_hostkey: true
track_submodules: true
- name: build windbot
shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5
args:
chdir: '{{home_path}}/windbot'
- name: link windbot.exe
file:
state: link
src: './bin/Release/WindBot.exe'
path: '{{home_path}}/windbot/WindBot.exe'
when: install
- name: link cards.cdb
file:
state: link
src: '{{home_path}}/ygopro/cards.cdb'
path: '{{home_path}}/windbot/cards.cdb'
when: install
- name: set default ygopro_fork
set_fact:
ygopro_fork: '{{fork}}'
when: ygopro_fork is not defined
- name: set default ygopro_branch
set_fact:
ygopro_branch: server
when: ygopro_branch is not defined
- name: ygopro
git:
repo: 'https://code.mycard.moe/{{ygopro_fork}}/ygopro'
dest: '{{ygopro_path}}'
version: '{{ygopro_branch}}'
force: true
accept_hostkey: true
track_submodules: true
- name: premake5
unarchive:
src: https://cdn01.moecube.com/ygopro-build-materials/premake-5.0.0-beta1-linux.tar.gz
dest: '{{ygopro_path}}/'
creates: '{{ygopro_path}}/premake5'
remote_src: true
- name: download lua
unarchive:
src: https://cdn02.moecube.com:444/ygopro-build-materials/lua-5.3.6.tar.gz
dest: /tmp/
creates: /tmp/lua-5.3.6
remote_src: true
when: ansible_os_family != 'Debian'
- name: move lua
shell: 'cp -rf /tmp/lua-5.3.6 {{ygopro_path}}/lua ; cp -rf {{ygopro_path}}/premake/lua/premake5.lua {{ygopro_path}}/lua/'
args:
creates: '{{ygopro_path}}/lua/premake5.lua'
when: ansible_os_family != 'Debian'
- name: init default params
set_fact:
premake_params: ''
when: premake_params is not defined
- name: debian params
set_fact:
premake_params: '{{premake_params}} --lua-deb'
when: ansible_os_family == 'Debian'
- name: premake5 gmake
shell: './premake5 gmake {{premake_params}}'
args:
chdir: '{{ygopro_path}}'
- name: build
make:
chdir: '{{ygopro_path}}/build'
target: "config=release"
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro
shell: strip bin/release/ygopro
ignore_errors: true
args:
chdir: '{{ygopro_path}}'
- name: link ygopro
file:
state: link
src: './bin/release/ygopro'
path: '{{ygopro_path}}/ygopro'
- name: replay directory
file:
state: directory
path: '{{ygopro_path}}/replay'
...@@ -5,82 +5,26 @@ ...@@ -5,82 +5,26 @@
# home_path: ~ # home_path: ~
# fork: mycard # fork: mycard
backup_name: '{{lookup("pipe","date +%m.%d")}}' backup_name: '{{lookup("pipe","date +%m.%d")}}'
install: false
tasks: tasks:
- name: pre data
git:
repo: 'https://e.coding.net/mercury233/ygopro-pre-data.git'
dest: '{{home_path}}/ygopro-pre-data'
force: true
accept_hostkey: true
track_submodules: true
- name: srvpro
git:
repo: 'https://code.mycard.moe/{{fork}}/srvpro'
dest: '{{home_path}}/ygopro-server'
version: '{{srvpro_branch}}'
force: true
accept_hostkey: true
track_submodules: true
register: srvpro_result
- name: srvpro npm
npm:
path: '{{home_path}}/ygopro-server'
ci: true
when: srvpro_result.changed
- name: windbot
git:
repo: 'https://code.mycard.moe/{{fork}}/windbot'
dest: '{{home_path}}/windbot'
version: '{{windbot_branch}}'
force: true
accept_hostkey: true
track_submodules: true
when: 'server_type != "tournament"'
- name: build windbot
shell: xbuild /p:Configuration=Release /p:TargetFrameworkVersion=v4.5
args:
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'
state: absent state: absent
- name: premake5
unarchive:
src: https:/cdn01.moecube.com/nanahira/premake-5.0.0-alpha14-linux.tar.gz
dest: '{{home_path}}/ygopro/'
creates: '{{home_path}}/ygopro/premake5'
remote_src: true
- name: ygopro new - name: ygopro new
shell: 'cp -rf {{home_path}}/ygopro {{home_path}}/ygopro-new' shell: 'cp -rf {{home_path}}/ygopro {{home_path}}/ygopro-new'
- name: ygopro - name: ygopro
git: include_tasks: ./tasks/srvpro/ygopro.yml
repo: 'https://code.mycard.moe/{{fork}}/ygopro' vars:
dest: '{{home_path}}/ygopro-new' ygopro_path: '{{home_path}}/ygopro-new'
version: '{{ygopro_branch}}'
force: true
accept_hostkey: true
track_submodules: true
- name: debian params
set_fact:
premake_params: '{{premake_params}} --lua-deb'
- name: premake5 gmake
shell: './premake5 gmake {{premake_params}}'
args:
chdir: '{{home_path}}/ygopro-new'
- name: build
make:
chdir: '{{home_path}}/ygopro-new/build'
target: 'config=release'
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro
shell: strip bin/release/ygopro
args:
chdir: '{{home_path}}/ygopro-new'
- name: remove same backup - name: remove same backup
file: file:
path: '{{home_path}}/ygopro-backup-{{backup_name}}' path: '{{home_path}}/ygopro-backup-{{backup_name}}'
state: absent state: absent
- name: move ygopro - name: move ygopro
shell: 'mv {{home_path}}/ygopro {{home_path}}/ygopro-backup-{{backup_name}} && mv {{home_path}}/ygopro-new {{home_path}}/ygopro' shell: 'mv {{home_path}}/ygopro {{home_path}}/ygopro-backup-{{backup_name}} && mv {{home_path}}/ygopro-new {{home_path}}/ygopro'
- name: common
include_tasks: ./tasks/srvpro/common.yml
- name: update callback
shell: '{{update_callback}}'
when: update_callback is defined and update_callback
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