2022-06-27 01:18:46 +00:00
|
|
|
- name: Deploy Application
|
2022-05-10 09:35:30 +00:00
|
|
|
hosts: all
|
|
|
|
become: yes
|
|
|
|
become_method: sudo
|
|
|
|
|
|
|
|
vars_files:
|
|
|
|
- vars/main.yml
|
2022-07-05 08:55:17 +00:00
|
|
|
|
2022-07-11 03:19:15 +00:00
|
|
|
pre_tasks:
|
2022-07-11 04:04:10 +00:00
|
|
|
- name: Get applist
|
2022-07-11 03:19:15 +00:00
|
|
|
block:
|
2022-12-10 00:59:40 +00:00
|
|
|
- name: Multiply apps execute on second time
|
2022-12-10 00:58:56 +00:00
|
|
|
shell : |
|
|
|
|
echo "" > /tmp/port.txt
|
2022-12-10 00:59:40 +00:00
|
|
|
|
2022-07-11 04:04:10 +00:00
|
|
|
- name: Get appname and dependencies, combine to a applist
|
|
|
|
shell : |
|
2022-10-26 02:10:44 +00:00
|
|
|
echo "{{appname}}" > applist
|
2022-12-09 02:59:18 +00:00
|
|
|
cat ./roles/{{appname}}/meta/main.yml | sed -n '/dependencies/,/galaxy_info/{//!p}'|grep -|awk -F'- ' '{print $2}' >> applist
|
2022-10-26 02:10:44 +00:00
|
|
|
cat applist
|
2022-07-11 04:04:10 +00:00
|
|
|
register: applist
|
2022-10-26 01:12:24 +00:00
|
|
|
delegate_to: 127.0.0.1
|
2022-09-07 04:05:35 +00:00
|
|
|
|
2022-08-23 09:01:51 +00:00
|
|
|
- name: Check if nginx is necessary
|
|
|
|
shell : |
|
2022-10-22 01:17:14 +00:00
|
|
|
wget -N https://raw.githubusercontent.com/Websoft9/docker-library/main/apps/{{appname}}/.env
|
2022-08-23 09:14:08 +00:00
|
|
|
cat .env
|
|
|
|
register: env_content
|
2022-09-07 02:13:19 +00:00
|
|
|
failed_when: False
|
2022-10-26 01:12:24 +00:00
|
|
|
delegate_to: 127.0.0.1
|
2022-12-09 03:15:44 +00:00
|
|
|
|
2022-12-09 03:21:36 +00:00
|
|
|
- name: Create credentials Folder for put get_ip.sh
|
2022-12-09 03:15:44 +00:00
|
|
|
file:
|
|
|
|
path: /credentials
|
|
|
|
state: directory
|
2022-12-09 03:25:19 +00:00
|
|
|
|
|
|
|
- name: Copy get_ip.sh
|
|
|
|
copy: src=../scripts/get_ip.sh dest=/credentials/get_ip.sh
|
|
|
|
|
2022-05-10 09:35:30 +00:00
|
|
|
roles:
|
2022-09-07 04:56:34 +00:00
|
|
|
- { role: role_common, tags: "role_common" }
|
|
|
|
- { role: role_cloud, tags: "role_cloud" }
|
|
|
|
- { role: "{{appname}}", tags: "{{appname}}" }
|
2022-08-23 09:14:08 +00:00
|
|
|
- { role: role_nginx, tags: "role_nginx", when: env_content.stdout.find('APP_HTTP_PORT') != -1 }
|
2022-05-11 01:51:13 +00:00
|
|
|
- { role: role_init, tags: "role_init" }
|
|
|
|
- { role: role_preend, tags: "preend" }
|
|
|
|
- { role: role_end, tags: "role_end" }
|