From 19d63d6daa106a0f8ae3d1053f2b802a60b86e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 15 Oct 2024 21:37:22 +0200 Subject: [PATCH] docker: migrate to Docker Compose 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 | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index f87710a..1cd5f0f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -81,7 +81,7 @@ alertmanager_victorops_display_name: >- # For discovery of prometheus master nodes consul_catalog_url: 'http://localhost:8500/v1/catalog' -# Generic container options -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 bea8e9e..93636df 100644 --- a/tasks/container.yml +++ b/tasks/container.yml @@ -28,11 +28,9 @@ oauth_upstream_url: 'http://app:{{ alertmanager_webui_port }}/' - name: Create containers - docker_compose: + community.docker.docker_compose_v2: project_src: '{{ alertmanager_service_path }}' files: ['{{ alertmanager_compose_file }}', '{{ alertmanager_oauth_compose_file }}'] - pull: true - build: false - state: '{{ compose_state }}' - restarted: '{{ compose_restart }}' - recreate: '{{ alertmanager_config.changed | ternary("always", compose_recreate) }}' + recreate: '{{ compose_recreate }}' + pull: '{{ compose_pull }}' + state: '{{ "restarted" if alertmanager_config.changed else compose_state }}'