websoft9/apps/roles/install/tasks/main.yml
2022-05-16 17:39:35 +08:00

36 lines
894 B
YAML

- name: Rename and Run docker-compose
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}}/volumes"
- name: Set softlink of all volumes
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}}/volumes/{{item}}"
state: link
force: yes
loop: "{{volume_names.stdout_lines}}"
- name: Check Docker Container Service
shell: docker ps
register: check_container_service
notify: check_container_service