Added logic to start docker compose pull just once per directory

This commit is contained in:
2025-08-20 07:02:27 +02:00
parent 594d9417d1
commit ec07d1a20b
3 changed files with 14 additions and 8 deletions

View File

@@ -14,7 +14,7 @@
- name: docker compose pull
shell: |
set -euo pipefail
lock="/run/ansible/compose-pull/{{ docker_compose.directories.instance | hash('sha1') }}"
lock="{{ [ PATH_DOCKER_COMPOSE_PULL_LOCK_DIR | docker_compose.directories.instance ] path_join | hash('sha1') }}"
if [ ! -e "$lock" ]; then
mkdir -p "$(dirname "$lock")"
docker compose pull
@@ -29,7 +29,7 @@
environment:
COMPOSE_HTTP_TIMEOUT: 600
DOCKER_CLIENT_TIMEOUT: 600
when: (MODE_UPDATE | bool
when: MODE_UPDATE | bool
listen:
- docker compose up
- docker compose restart

View File

@@ -1,3 +1,8 @@
- name: Remove all docker compose pull locks
file:
path: "{{ PATH_DOCKER_COMPOSE_PULL_LOCK_DIR }}"
state: absent
- name: "Load docker container role"
include_role:
name: docker-container