From 5e48c5ec8a5bbc14564c8f9229d4514dd17a2c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 1 Aug 2024 19:53:28 +0200 Subject: [PATCH] docker: upgrade Docker Compose to V2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- defaults/main.yml | 6 +++--- tasks/container.yml | 9 ++++----- templates/docker-compose.yml.j2 | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0ae826b..8e9bbe9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -63,7 +63,7 @@ gitea_container_cleanup_timer_frequency: 'daily' gitea_container_cleanup_timer_timeout: 120 gitea_cleanup_max_retention: 15 -# General container management -compose_recreate: 'smart' +# general container management +compose_recreate: 'auto' compose_state: 'present' -compose_restart: false +compose_pull: 'always' diff --git a/tasks/container.yml b/tasks/container.yml index 36fbe3f..6f1ac6c 100644 --- a/tasks/container.yml +++ b/tasks/container.yml @@ -8,10 +8,9 @@ mode: 0640 - name: Create containers - docker_compose: + community.docker.docker_compose_v2: project_src: '{{ gitea_service_path }}' - pull: true - state: '{{ compose_state }}' - restarted: '{{ compose_restart }}' - recreate: '{{ gitea_config.changed | ternary("always", compose_recreate) }}' + recreate: '{{ compose_recreate }}' + pull: '{{ compose_pull }}' + recreate: '{{ gitea_config.changed | ternary("always", compose_recreate) }}' register: gitea_container diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 8c32683..cdf0238 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -1,5 +1,4 @@ --- -version: '3.7' services: app: container_name: '{{ gitea_app_cont_name }}' @@ -14,7 +13,7 @@ services: - '{{ gitea_app_cont_ssh_port }}:22/tcp' depends_on: - db - + db: container_name: '{{ gitea_db_cont_name }}' image: '{{ gitea_db_cont_image }}'