From c1a667786cf2d7c9faf8a3d4c260a84f6988adf9 Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Wed, 26 May 2021 12:06:05 +0200 Subject: [PATCH] review handler to prometheus container --- handlers/main.yml | 10 +++++----- tasks/prometheus.yml | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 9d45f39..149bea2 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,10 +1,10 @@ --- - name: 'prometheus | server | restart container' - systemd: - name: openvpn@{{ ansible_hostname }}.service - state: started - enabled: yes - tags: ['prometheus'] + docker_container: + name: prometheus + restart: yes + when: + - 'not register_docker_container_grafana.changed' - name: 'prometheus | node exporter | restart service' systemd: diff --git a/tasks/prometheus.yml b/tasks/prometheus.yml index 3762a2f..086a411 100644 --- a/tasks/prometheus.yml +++ b/tasks/prometheus.yml @@ -11,13 +11,11 @@ name: 'prometheus' tags: - prometheus - when: prometheus_server_enable == "true" - name: 'prometheus | server | create docker volume data' docker_volume: name: prometheus_data register: register_docker_volume_prometheus__prometheus_data - when: prometheus_server_enable == "true" tags: - prometheus @@ -26,7 +24,6 @@ path: /etc/prometheus state: directory mode: '0755' - when: prometheus_server_enable == "true" tags: - prometheus @@ -37,11 +34,10 @@ owner: root group: root mode: 0644 - when: - - prometheus_server_enable == "true" - - prometheus_server_monitor is defined tags: - prometheus + notify: + - 'prometheus | server | restart container' - name: 'prometheus | server | deploy container' docker_container: @@ -66,7 +62,7 @@ tag: docker_prometheus restart_policy: 'unless-stopped' pull: '{{ awh_services_docker_pull|default("no") }}' - when: prometheus_server_enable == "true" tags: - prometheus - + notify: + - 'prometheus | server | restart container'