72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
---
|
|
- name: Deploy GoLeaf release
|
|
hosts: google
|
|
remote_user: root
|
|
vars:
|
|
goleaf_src: /data/devops/source/main
|
|
goleaf_dest: /usr/local/game
|
|
config_src: /data/docs/tool/out/
|
|
config_dest: /usr/local/game/gamedata/config/
|
|
pack_script: /data/devops/pack.sh
|
|
tar_file: /usr/local/Goleaf.tar
|
|
tar_dest: /usr/local/game
|
|
|
|
tasks:
|
|
- name: change git branch
|
|
shell: cd /codes/pet_home_server && git checkout online && git pull
|
|
delegate_to: localhost
|
|
run_once: true
|
|
register: git_result
|
|
|
|
- name: change docs git branch
|
|
shell: cd /data/docs && git checkout online && git pull
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: protoc protobuff
|
|
shell: cd /data/docs && protoc --go_out=/codes/pet_home_server/src/server/msg ./proto/Gameapi.proto
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: sh pack.sh
|
|
shell: sh /data/devops/pack.sh
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: remove old backup
|
|
shell: rm -rf {{goleaf_dest}}/main.bak
|
|
ignore_errors: yes
|
|
- name: backup goleaf
|
|
shell: mv {{goleaf_dest}}/main {{goleaf_dest}}/main.bak
|
|
ignore_errors: yes
|
|
- name: copy goleaf
|
|
copy:
|
|
src: "{{ goleaf_src }}"
|
|
dest: "{{goleaf_dest}}"
|
|
mode: 0755
|
|
|
|
|
|
- name: parse config
|
|
shell: cd /data/docs && git pull && python3 /data/docs/tool/cfg/tool_cfg_json.py
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: archive config
|
|
archive:
|
|
path: /data/docs/tool/config/
|
|
dest: /data/docs/tool/conf.tar
|
|
format: tar
|
|
delegate_to: localhost
|
|
|
|
- name: copy tar
|
|
copy:
|
|
src: /data/docs/tool/conf.tar
|
|
dest: /usr/local/game
|
|
|
|
- unarchive:
|
|
src: /usr/local/game/conf.tar
|
|
dest: /usr/local/game/gamedata/config
|
|
remote_src: yes
|
|
extra_opts: [--overwrite]
|
|
|