mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-24 10:17:15 +08:00
Create install.yml
This commit is contained in:
parent
e00e80c27b
commit
cf3a3c8b30
35
apps/tasks/install.yml
Normal file
35
apps/tasks/install.yml
Normal file
@ -0,0 +1,35 @@
|
||||
- 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
|
Loading…
Reference in New Issue
Block a user