websoft9/apps/roles/install/tasks/main.yml
2022-05-12 16:26:01 +08:00

42 lines
1.2 KiB
YAML

- name: Delete {{appname}} dir for sec_installation
shell: rm -rf /data/apps/{{appname}}
- name: Clone {{appname}} in Websoft9
git:
repo: "https://github.com/Websoft9/docker-{{appname}}.git"
dest: /data/apps/{{appname}}
- 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: sed -n '/^volumes:/,/^network/{p}' /data/apps/{{appname}}/docker-compose.yml | grep -v volumes:
register: volume_names
- name: Create softlink of volumes
file:
src: "/var/lib/docker/volumes/discuzq_{{item | replace(' ', '') | replace(':', '')}}/_data"
dest: "/data/apps/{{appname}}/volumes/{{item | replace(' ', '') | replace(':', '')}}"
state: link
force: yes
loop: {{volume_names.stout}}
- name: Check Docker Container Service
shell: docker ps
register: check_container_service
notify: check_container_service