2022-06-27 09:09:03 +08:00
|
|
|
- name: Docker compose up
|
2022-05-11 12:01:49 +08:00
|
|
|
shell: |
|
2022-06-27 09:06:57 +08:00
|
|
|
docker compose up -d
|
2022-05-11 12:01:49 +08:00
|
|
|
sleep 30
|
|
|
|
args:
|
2022-05-16 10:10:52 +08:00
|
|
|
chdir: "{{installpath}}/{{appname}}"
|
2022-05-11 12:01:49 +08:00
|
|
|
|
|
|
|
- name: Recursively create directory for {{appname}}
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
2022-06-27 09:06:57 +08:00
|
|
|
- "{{installpath}}/{{appname}}/data"
|
2022-05-11 12:01:49 +08:00
|
|
|
|
2022-06-27 09:06:57 +08:00
|
|
|
- name: Add softlink of all volumes for app root directory
|
2022-05-12 15:49:18 +08:00
|
|
|
block:
|
|
|
|
- name: Get volumes name
|
2022-06-27 09:09:03 +08:00
|
|
|
shell: docker compose config --volumes
|
2022-05-12 15:49:18 +08:00
|
|
|
register: volume_names
|
2022-05-13 08:39:46 +08:00
|
|
|
args:
|
2022-05-16 10:10:52 +08:00
|
|
|
chdir: "{{installpath}}/{{appname}}"
|
2022-05-12 15:49:18 +08:00
|
|
|
|
|
|
|
- name: Create softlink of volumes
|
|
|
|
file:
|
2022-05-16 17:39:35 +08:00
|
|
|
src: "/var/lib/docker/volumes/{{appname}}_{{item}}/_data"
|
2022-06-27 09:06:57 +08:00
|
|
|
dest: "{{installpath}}/{{appname}}/data/{{item}}"
|
2022-05-12 15:49:18 +08:00
|
|
|
state: link
|
|
|
|
force: yes
|
2022-05-12 16:45:01 +08:00
|
|
|
loop: "{{volume_names.stdout_lines}}"
|
2022-05-11 14:40:10 +08:00
|
|
|
|
2022-05-12 11:57:18 +08:00
|
|
|
- name: Check Docker Container Service
|
2022-06-29 17:41:04 +08:00
|
|
|
shell: docker ps --format \{\{'json .'\}\}| jq -s map\(\{containername:'.Names',state:'.State'\}\)
|
2022-05-12 11:57:18 +08:00
|
|
|
register: check_container_service
|
|
|
|
notify: check_container_service
|