websoft9/apps/application.yml

52 lines
1.6 KiB
YAML
Raw Normal View History

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 09:14:05 +08:00
- name: Excute base roles for apps(step1)
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:
2022-07-01 09:10:45 +08:00
- role_common
- role_cloud
2022-07-01 09:14:05 +08:00
- name: Git Clone app docker repository(step2)
2022-07-01 09:08:07 +08:00
block:
- name: Create app directory
shell: mkdir -p {{installpath}}
- name: Delete {{appname}} dir for sec_installation
shell: rm -rf {{installpath}}/{{appname}}
- name: Clone {{appname}} in Websoft9
git:
repo: "https://github.com/Websoft9/docker-{{appname}}.git"
2022-07-01 09:14:05 +08:00
dest: "{{installpath}}/{{appname}}"
- name: Excute Preparation if have pre.yml(step3)
2022-05-17 14:58:09 +08:00
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-07-01 09:14:05 +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-07-04 15:51:33 +08:00
import_role:
2022-05-17 14:58:09 +08:00
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" }