新增部署脚本
This commit is contained in:
parent
dc97ed1938
commit
02b90f34a4
65
playbook/merge_pet_audit.yml
Normal file
65
playbook/merge_pet_audit.yml
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
- name: Deploy GoleafAudit release
|
||||
hosts: test
|
||||
gather_facts: no
|
||||
remote_user: root
|
||||
vars:
|
||||
GoleafAudit_src: /data/devops/source/main
|
||||
GoleafAudit_dest: /usr/local/GoleafAudit
|
||||
config_src: /data/docs/tool/out/
|
||||
config_dest: /usr/local/GoleafAudit/gamedata/config/
|
||||
pack_script: /data/devops/pack.sh
|
||||
tar_file: /usr/local/GoleafAudit.tar
|
||||
tar_dest: /usr/local/GoleafAudit
|
||||
|
||||
tasks:
|
||||
|
||||
- name: change git branch
|
||||
shell: cd /codes/pet_home_server && git checkout audit && 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: sh pack.sh
|
||||
shell: sh /data/devops/pack.sh
|
||||
delegate_to: localhost
|
||||
- name: backup GoleafAudit
|
||||
shell: mv /usr/local/GoleafAudit/main /usr/local/GoleafAudit/main.bak
|
||||
ignore_errors: yes
|
||||
|
||||
- name: copy GoleafAudit
|
||||
copy:
|
||||
src: "{{ GoleafAudit_src }}"
|
||||
dest: "{{GoleafAudit_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: /usr/local/GoleafAudit/config/
|
||||
dest: /usr/local/GoleafAudit/confbak.tar
|
||||
format: tar
|
||||
ignore_errors: yes
|
||||
- name: copy tar
|
||||
copy:
|
||||
src: /data/docs/tool/conf.tar
|
||||
dest: /usr/local/GoleafAudit/conf.tar
|
||||
- name: unarchive config
|
||||
unarchive:
|
||||
src: /usr/local/GoleafAudit/conf.tar
|
||||
dest: /usr/local/GoleafAudit/config/
|
||||
remote_src: yes
|
||||
# extra_opts: [--overwrite]
|
||||
- name: remove tar
|
||||
shell: rm -f /usr/local/GoleafAudit/conf.tar
|
||||
Loading…
Reference in New Issue
Block a user