devops/playbook/goleaf-hwb.yml
2025-01-22 16:39:11 +08:00

52 lines
1.3 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: sh pack.sh
shell: sh /data/devops/pack.sh
delegate_to: localhost
- name: copy goleaf
copy:
src: "{{ goleaf_src }}"
dest: "{{goleaf_dest}}"
- name: copy goleaf
command: tar -cvf /usr/local/conf.tar -C /data/docs/tool/config .
delegate_to: localhost
- 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