devops/playbook/merge_pet_test.yml
2025-01-10 12:09:43 +08:00

61 lines
1.6 KiB
YAML

---
- name: Deploy GoLeaf release
hosts: test
gather_facts: no
remote_user: root
vars:
goleaf_src: /data/devops/source/main
goleaf_dest: /usr/local/Goleaf
config_src: /data/docs/tool/out/
config_dest: /usr/local/Goleaf/gamedata/config/
pack_script: /data/devops/pack.sh
tar_file: /usr/local/Goleaf.tar
tar_dest: /usr/local/Goleaf
tasks:
- name: stop goleaf
command: "{{ goleaf_dest }}/tool/tool stop node 1"
register: stop_result
ignore_errors: yes
- name: show stop_result
debug:
var: stop_result.stdout_lines
- name: change git branch
shell: cd /codes/pet_home_server && git checkout develop && git pull
delegate_to: localhost
register: git_result
- name: sh pack.sh
shell: sh /data/devops/pack.sh
delegate_to: localhost
- name: copy goleaf
copy:
src: "{{ goleaf_src }}"
dest: "{{goleaf_dest}}"
- name: parse config
shell: cd /data/docs && git pull && python3 /data/docs/tool/cfg/tool_cfg_json.py
delegate_to: localhost
- name: tar config
command: tar -cvf /usr/local/conf.tar -C /data/docs/tool/out .
delegate_to: localhost
warn: false
- name: copy tar
copy:
src: /usr/local/conf.tar
dest: /usr/local/Goleaf
- name : untar
command: tar -xvf /usr/local/Goleaf/conf.tar -C /usr/local/Goleaf/config/
- name: start goleaf
shell: nohup /usr/local/Goleaf/tool/tool start node 1 &
register: restart_result
- name: show restart result
debug:
var: restart_result.stdout_lines