2022-07-05 14:28:45 +08:00
|
|
|
- name: Create docker network websoft9
|
|
|
|
shell: docker network create websoft9
|
2022-07-05 14:41:02 +08:00
|
|
|
failed_when: False
|
2022-07-05 14:37:42 +08:00
|
|
|
|
2022-07-05 10:49:24 +08:00
|
|
|
- name: Docker compose up
|
|
|
|
shell: |
|
|
|
|
docker compose up -d
|
|
|
|
sleep 30
|
|
|
|
args:
|
|
|
|
chdir: "{{installpath}}/{{appname}}"
|
|
|
|
|
|
|
|
- name: Recursively create directory for {{appname}}
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- "{{installpath}}/{{appname}}/data"
|
|
|
|
|
|
|
|
- name: Add softlink of all volumes for app root directory
|
|
|
|
block:
|
|
|
|
- name: Get volumes name
|
|
|
|
shell: docker compose config --volumes
|
|
|
|
register: volume_names
|
|
|
|
args:
|
|
|
|
chdir: "{{installpath}}/{{appname}}"
|
|
|
|
|
|
|
|
- name: Create softlink of volumes
|
|
|
|
file:
|
|
|
|
src: "/var/lib/docker/volumes/{{appname}}_{{item}}/_data"
|
|
|
|
dest: "{{installpath}}/{{appname}}/data/{{item}}"
|
|
|
|
state: link
|
|
|
|
force: yes
|
|
|
|
loop: "{{volume_names.stdout_lines}}"
|
|
|
|
|
|
|
|
- name: Check Docker Container Service
|
|
|
|
shell: docker ps --format \{\{'json .'\}\}| jq -s map\(\{containername:'.Names',state:'.State'\}\)
|
|
|
|
register: check_container_service
|
|
|
|
notify: check_container_service
|
2022-07-05 16:46:33 +08:00
|
|
|
|
|
|
|
handlers:
|
|
|
|
- name: restart httpd
|
|
|
|
service: name=httpd state=restarted
|