role service-prometheus: change handlers from reload to restart and add handler to reload systemd units

This commit is contained in:
Julian Labus 2018-09-11 14:11:20 +02:00
parent 07ab6837fe
commit ee634b5397
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A
4 changed files with 26 additions and 8 deletions

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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: