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 }}'