devops/playbook/merge_pet_backend.yml
2026-03-13 17:56:05 +08:00

71 lines
1.9 KiB
YAML

---
- name: Deploy GoLeaf release
hosts: new-test
gather_facts: no
remote_user: root
vars:
goleaf_src: /data/devops/source/main
goleaf_dest: /data/Goleaf
config_src: /data/docs/tool/out/
config_dest: /data/Goleaf/gamedata/config/
pack_script: /data/devops/pack.sh
tar_file: /data/Goleaf.tar
tar_dest: /data/Goleaf
tasks:
# - name: change git branch
# shell: cd /codes/pet_home_server && git checkout develop && git pull
# delegate_to: localhost
# register: git_result
# - name: change docs git branch
# shell: cd /data/docs && git checkout main && git pull
# delegate_to: localhost
- name: protoc protobuff
shell: cd /data/docs && protoc --go_out=/codes/game_backend/msg ./proto/Gameapi.proto
delegate_to: localhost
- name: sh pack.sh
shell: sh /data/devops/pack_backend.sh
delegate_to: localhost
- name: backup goleaf
shell: mv /data/Goleaf/main /data/Goleaf/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
- name: archive config
archive:
path: /data/docs/tool/config/
dest: /data/docs/tool/conf.tar
format: tar
delegate_to: localhost
- name: archive backup config
archive:
path: /data/Goleaf/config/
dest: /data/Goleaf/confbak.tar
format: tar
ignore_errors: yes
- name: copy tar
copy:
src: /data/docs/tool/conf.tar
dest: /data/Goleaf/conf.tar
- name: unarchive config
unarchive:
src: /data/Goleaf/conf.tar
dest: /data/Goleaf/config/
remote_src: yes
# extra_opts: [--overwrite]
- name: remove tar
shell: rm -f /data/Goleaf/conf.tar