2022-06-27 09:18:46 +08:00
|
|
|
- name: Deploy Application
|
2022-05-10 17:35:30 +08:00
|
|
|
hosts: all
|
|
|
|
become: yes
|
|
|
|
become_method: sudo
|
|
|
|
|
|
|
|
vars_files:
|
|
|
|
- vars/main.yml
|
2022-05-16 17:22:57 +08:00
|
|
|
|
2022-05-11 17:39:42 +08:00
|
|
|
pre_tasks:
|
2022-06-27 09:18:46 +08:00
|
|
|
- name: Git Clone app docker repository
|
2022-05-13 08:59:20 +08:00
|
|
|
block:
|
|
|
|
- name: Create app directory
|
2022-05-16 10:10:12 +08:00
|
|
|
shell: mkdir -p {{installpath}}
|
2022-05-13 08:59:20 +08:00
|
|
|
- name: Delete {{appname}} dir for sec_installation
|
2022-05-16 10:10:12 +08:00
|
|
|
shell: rm -rf {{installpath}}/{{appname}}
|
2022-05-13 08:59:20 +08:00
|
|
|
- name: Clone {{appname}} in Websoft9
|
|
|
|
git:
|
|
|
|
repo: "https://github.com/Websoft9/docker-{{appname}}.git"
|
2022-05-16 12:09:07 +08:00
|
|
|
dest: "{{installpath}}/{{appname}}"
|
2022-05-16 17:22:57 +08:00
|
|
|
|
2022-05-17 14:58:09 +08:00
|
|
|
- name: Excute Preparation if have pre.yml
|
|
|
|
block:
|
2022-06-27 09:18:46 +08:00
|
|
|
- name: Check if pre.yml exists
|
2022-06-30 11:02:53 +08:00
|
|
|
uri:
|
2022-06-30 11:08:55 +08:00
|
|
|
url: "https://github.com/Websoft9/StackHub/blob/main/apps/roles/{{appname}}/tasks/pre.yml"
|
2022-05-17 14:58:09 +08:00
|
|
|
register: pre_exists
|
2022-06-30 11:19:51 +08:00
|
|
|
retries: 10
|
|
|
|
delay: 5
|
|
|
|
failed_when: "'FAILED' in pre_exists.stdout"
|
2022-06-30 10:45:29 +08:00
|
|
|
|
2022-06-27 09:18:46 +08:00
|
|
|
- name: Excute pre.yml
|
2022-05-17 14:58:09 +08:00
|
|
|
include_role:
|
|
|
|
name: "{{appname}}"
|
|
|
|
tasks_from: "pre"
|
2022-06-30 11:05:50 +08:00
|
|
|
when: pre_exists.status == 200
|
2022-05-16 17:22:57 +08:00
|
|
|
|
2022-05-10 17:35:30 +08:00
|
|
|
roles:
|
2022-05-11 09:51:13 +08:00
|
|
|
- { role: role_common, tags: "role_common" }
|
|
|
|
- { role: role_cloud, tags: "role_cloud" }
|
|
|
|
- { role: role_nginx, tags: "role_nginx" }
|
2022-05-12 14:09:58 +08:00
|
|
|
- { role: install, tags: "install" }
|
2022-05-11 09:51:13 +08:00
|
|
|
- { role: "{{appname}}", tags: "{{appname}}" }
|
|
|
|
- { role: role_init, tags: "role_init" }
|
|
|
|
- { role: role_preend, tags: "preend" }
|
|
|
|
- { role: role_end, tags: "role_end" }
|