mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-27 13:08:39 +08:00
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
- name: Check {{appname}} exists
|
|
stat:
|
|
path: /data/apps/{{appname}}
|
|
register: app_exists
|
|
|
|
- name: Clone {{appname}} in Websoft9 if pretask not do this
|
|
git:
|
|
repo: "https://github.com/Websoft9/docker-{{appname}}.git"
|
|
dest: /data/apps/{{appname}}
|
|
when: not app_exists.stat.exists
|
|
|
|
- name: Rename and Run docker-compose
|
|
shell: |
|
|
docker-compose up -d
|
|
sleep 30
|
|
args:
|
|
chdir: "/data/apps/{{appname}}"
|
|
|
|
- name: Recursively create directory for {{appname}}
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
recurse: yes
|
|
with_items:
|
|
- "/data/apps/{{appname}}/volumes"
|
|
|
|
- name: Set softlink of all volumes
|
|
block:
|
|
- name: Get volumes name
|
|
shell: docker-compose config --volumes
|
|
register: volume_names
|
|
args:
|
|
chdir: "/data/apps/{{appname}}"
|
|
|
|
- name: Create softlink of volumes
|
|
file:
|
|
src: "/var/lib/docker/volumes/docker_{{item}}/_data"
|
|
dest: "/data/apps/{{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
|