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