mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-24 10:17:15 +08:00
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
- name: Deploy Application
|
|
hosts: all
|
|
become: yes
|
|
become_method: sudo
|
|
|
|
vars_files:
|
|
- vars/main.yml
|
|
|
|
pre_tasks:
|
|
- name: Git Clone app docker repository
|
|
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"
|
|
dest: "{{installpath}}/{{appname}}"
|
|
|
|
- name: Excute Preparation if have pre.yml
|
|
block:
|
|
- name: Check if pre.yml exists
|
|
stat:
|
|
path: roles/{{appname}}/tasks/pre.yml
|
|
register: pre_exists
|
|
|
|
- debug: msg="Path exists and is a directory"
|
|
when: pre_exists.stat.exists
|
|
|
|
- name: Excute pre.yml
|
|
include_role:
|
|
name: "{{appname}}"
|
|
tasks_from: "pre"
|
|
when: pre_exists.stat.exists
|
|
|
|
roles:
|
|
- { role: role_common, tags: "role_common" }
|
|
- { role: role_cloud, tags: "role_cloud" }
|
|
- { role: role_nginx, tags: "role_nginx" }
|
|
- { role: install, tags: "install" }
|
|
- { role: "{{appname}}", tags: "{{appname}}" }
|
|
- { role: role_init, tags: "role_init" }
|
|
- { role: role_preend, tags: "preend" }
|
|
- { role: role_end, tags: "role_end" }
|