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-07-01 08:40:50 +08:00
|
|
|
- name: Excute base roles for apps
|
2022-05-13 08:59:20 +08:00
|
|
|
block:
|
2022-06-30 17:45:00 +08:00
|
|
|
- name: Include base roles
|
|
|
|
include_role:
|
|
|
|
name: "{{item}}"
|
|
|
|
with_items:
|
|
|
|
- role_common
|
|
|
|
- role_cloud
|
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-06-30 11:33:00 +08:00
|
|
|
return_content: yes
|
2022-05-17 14:58:09 +08:00
|
|
|
register: pre_exists
|
2022-06-30 11:34:45 +08:00
|
|
|
failed_when: false
|
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:23:19 +08:00
|
|
|
when: pre_exists.status is defined and 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_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" }
|