diff options
Diffstat (limited to 'deploy')
| -rw-r--r-- | deploy/inventory.yml | 2 | ||||
| -rw-r--r-- | deploy/playbook.yml | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/deploy/inventory.yml b/deploy/inventory.yml index d3acab8..6b8a384 100644 --- a/deploy/inventory.yml +++ b/deploy/inventory.yml @@ -8,6 +8,7 @@ all: saya_today_web_hostname: sayauz-prod saya_today_web_ipv4_address: 172.16.0.17 saya_today_web_listen_address: saya.uz + saya_today_web_unix_sockets_mount: '/etc/sayauz' stage: hosts: @@ -17,3 +18,4 @@ all: saya_today_web_hostname: sayauz-stage saya_today_web_ipv4_address: 172.16.0.18 saya_today_web_listen_address: stage.saya.uz + saya_today_web_unix_sockets_mount: '/etc/sayauz' diff --git a/deploy/playbook.yml b/deploy/playbook.yml index 8fb9088..9719ed9 100644 --- a/deploy/playbook.yml +++ b/deploy/playbook.yml @@ -2,9 +2,27 @@ - name: Deploy saya-today-web Docker Container hosts: all remote_user: svc_github + + vars: + docker_volumes: + - "{{ saya_today_web_name }}-volume:/data:rw" tasks: - - name: Create a volume + - name: Initialize Unix socket volume + when: >- + saya_today_web_unix_sockets_path is defined and + saya_today_web_unix_sockets_path is string and + saya_today_web_unix_sockets_path | length > 0 + block: + - name: Ensure Unix socket volume exists + community.docker.docker_volume: + name: "sayana_sockets" + - name: Include Unix socket volume in docker volumes list + ansible.builtin.set_fact: + docker_volumes: >- + {{ docker_volumes + ["sayana_sockets:" ~ saya_today_web_unix_sockets_path ~ ":rw"] }} + + - name: Create a data volume community.docker.docker_volume: name: "{{ saya_today_web_name }}-volume" @@ -29,8 +47,7 @@ networks: - name: caddy ipv4_address: "{{ saya_today_web_ipv4_address }}" - volumes: - - "{{ saya_today_web_name }}-volume:/data:rw" + volumes: "{{ docker_volumes }}" restart_policy: unless-stopped no_log: true ... |