diff --git a/roles/service-prometheus/handlers/main.yml b/roles/service-prometheus/handlers/main.yml index a293535..91cb569 100644 --- a/roles/service-prometheus/handlers/main.yml +++ b/roles/service-prometheus/handlers/main.yml @@ -1,9 +1,18 @@ -- name: reload prometheus +- name: reload systemd + systemd: + daemon_reload: yes + +- name: restart prometheus service: name: prometheus - state: reloaded + state: restarted -- name: reload alertmanager +- name: restart alertmanager service: name: alertmanager - state: reloaded + state: restarted + +- name: restart node_exporter + service: + name: node_exporter + state: restarted diff --git a/roles/service-prometheus/tasks/alertmanager.yml b/roles/service-prometheus/tasks/alertmanager.yml index 1a97339..1264854 100644 --- a/roles/service-prometheus/tasks/alertmanager.yml +++ b/roles/service-prometheus/tasks/alertmanager.yml @@ -46,13 +46,16 @@ template: src: "alertmanager.service.j2" dest: "/lib/systemd/system/alertmanager.service" + notify: + - reload systemd + - restart alertmanager - name: install alertmanager config file copy: src: "alertmanager.yml" dest: "{{ prometheus_config_path }}/alertmanager.yml" notify: - - reload alertmanager + - restart alertmanager - name: enable alertmanager service service: diff --git a/roles/service-prometheus/tasks/node-exporter.yml b/roles/service-prometheus/tasks/node-exporter.yml index cb55d53..b5c21a4 100644 --- a/roles/service-prometheus/tasks/node-exporter.yml +++ b/roles/service-prometheus/tasks/node-exporter.yml @@ -32,6 +32,9 @@ template: src: "../templates/node_exporter.service.j2" dest: "/lib/systemd/system/node_exporter.service" + notify: + - reload systemd + - restart node_exporter - name: enable node_exporter service service: diff --git a/roles/service-prometheus/tasks/prometheus.yml b/roles/service-prometheus/tasks/prometheus.yml index 53fae23..1b773ff 100644 --- a/roles/service-prometheus/tasks/prometheus.yml +++ b/roles/service-prometheus/tasks/prometheus.yml @@ -44,6 +44,9 @@ template: src: "prometheus.service.j2" dest: "/lib/systemd/system/prometheus.service" + notify: + - reload systemd + - restart prometheus - name: copy rule files from playbook's, if any copy: @@ -52,7 +55,7 @@ validate: "{{ prometheus_daemon_dir }}/promtool check rules %s" with_dict: '{{ prometheus_rule_files | default({}) }}' notify: - - reload prometheus + - restart prometheus - name: copy prometheus main config file from role's default, if necessary template: @@ -61,7 +64,7 @@ validate: "{{ prometheus_daemon_dir }}/promtool check config %s" when: prometheus_conf_main is not defined notify: - - reload prometheus + - restart prometheus - name: copy prometheus main config file from playbook's, if any template: @@ -70,7 +73,7 @@ validate: "{{ prometheus_daemon_dir }}/promtool check config %s" when: prometheus_conf_main is defined notify: - - reload prometheus + - restart prometheus - name: enable prometheus service service: