first commit

This commit is contained in:
2021-08-28 23:54:41 +08:00
commit 06f4bf327a
55 changed files with 650 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
svn_url: "svn://xxx.xxx.xxx.xxx/xx/xx"
svn_opt: "--username xxxx --password xxxx --non-interactive"
repo: "{{svn_url|basename}}"
remote_dir: "/path/to/deploy/remote"

View File

@@ -0,0 +1,3 @@
---
- import_tasks: "{{task|lower}}.yml"

View File

@@ -0,0 +1,6 @@
---
- name: start {{repo}}
service: name={{repo}} state=started
#- name: wait for {{repo}} to start completely
#shell: while sleep 2; do grep -m 1 '(JVM running for [0-9\.]\+)$' {{remote_dir}}/../logs/{{repo}}.log && break; done

View File

@@ -0,0 +1,8 @@
---
- name: wait 2s to free connections
shell: sleep 2
- name: stop {{repo}}
service: name={{repo}} state=stopped
#- name: clean {{repo}} logs
#shell: cd {{remote_dir}}/../logs/{{repo}} && rm -f *

View File

@@ -0,0 +1,16 @@
---
- name: check whether {{repo}} exists
shell: ls {{repo}}/.svn || true
args:
chdir: "{{remote_dir}}"
register: repo_exists
- name: checkout {{repo}} from svn
shell: cd {{remote_dir}} && rm -rf {{repo}} && svn checkout {{svn_opt}} {{svn_url}} {{repo}} &>> {{ansible_env.SSH_TTY}}
when: repo_exists.stdout == ''
- name: update {{repo}} from svn
shell: cd {{remote_dir}}/{{repo}} && svn update {{svn_opt}} &>> {{ansible_env.SSH_TTY}}
register: update_result
when: repo_exists.stdout != ''