add handlers
This commit is contained in:
parent
30a119e241
commit
8aa8653e21
36
handlers/main.yml
Normal file
36
handlers/main.yml
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
- name: 'prometheus | server | restart container'
|
||||
systemd:
|
||||
name: openvpn@{{ ansible_hostname }}.service
|
||||
state: started
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
||||
- name: 'prometheus | node exporter | restart service'
|
||||
systemd:
|
||||
name: prometheus-node-exporter.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
||||
- name: 'prometheus | mysqld exporter | restart service'
|
||||
systemd:
|
||||
name: prometheus-mysqld-exporter.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
||||
- name: 'prometheus | mongodb exporter | restart service'
|
||||
systemd:
|
||||
name: prometheus-mongodb-exporter.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
||||
- name: 'prometheus | postgres exporter | restart service'
|
||||
systemd:
|
||||
name: prometheus-postgres-exporter.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
@ -1,4 +1,19 @@
|
||||
---
|
||||
- name: 'prometheus | mongodb exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-mongodb-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-mongodb-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
name: prometheus-mongodb-exporter.service
|
||||
|
||||
- name: 'prometheus | mongodb exporter | download'
|
||||
get_url:
|
||||
url: https://github.com/percona/mongodb_exporter/releases/download/v{{ prometheus_mongodb_exporter_version }}/mongodb_exporter-{{ prometheus_mongodb_exporter_version }}.linux-amd64.tar.gz
|
||||
@ -18,18 +33,6 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
notify:
|
||||
- 'prometheus | mysqld exporter | restart service'
|
||||
|
||||
- name: 'prometheus | mongodb exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-mongodb-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-mongodb-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
name: prometheus-mongodb-exporter.service
|
||||
|
@ -1,4 +1,18 @@
|
||||
---
|
||||
- name: 'prometheus | mysqld exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-mysqld-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-mysqld-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | mysqld exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
name: prometheus-mysqld-exporter.service
|
||||
|
||||
- name: 'prometheus | mysqld exporter | download'
|
||||
get_url:
|
||||
url: https://github.com/prometheus/mysqld_exporter/releases/download/v{{ prometheus_mysqld_exporter_version }}/mysqld_exporter-{{ prometheus_mysqld_exporter_version }}.linux-amd64.tar.gz
|
||||
@ -33,18 +47,6 @@
|
||||
when:
|
||||
- prometheus_mysqld_exporter_user is defined
|
||||
register: prometheus_mysqld_exporter_configuration
|
||||
notify:
|
||||
- 'prometheus | mysqld exporter | restart service'
|
||||
|
||||
- name: 'prometheus | mysqld exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-mysqld-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-mysqld-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | mysqld exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
name: prometheus-mysqld-exporter.service
|
||||
|
@ -1,4 +1,18 @@
|
||||
---
|
||||
- name: 'prometheus | node exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-node-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-node-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | node exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
name: prometheus-node-exporter.service
|
||||
|
||||
- name: 'prometheus | node exporter | download'
|
||||
get_url:
|
||||
url: https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_node_exporter_version }}/node_exporter-{{ prometheus_node_exporter_version }}.linux-amd64.tar.gz
|
||||
@ -18,18 +32,6 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
notify:
|
||||
- 'prometheus | node exporter | restart service'
|
||||
|
||||
- name: 'prometheus | node exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-node-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-node-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | node exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
name: prometheus-node-exporter.service
|
||||
|
@ -1,4 +1,20 @@
|
||||
---
|
||||
- name: 'prometheus | postgres exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-postgres-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-postgres-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
|
||||
- name: 'prometheus | postgres exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
name: prometheus-postgres-exporter.service
|
||||
|
||||
- name: 'prometheus | postgres exporter | download'
|
||||
get_url:
|
||||
url: https://github.com/prometheus-community/postgres_exporter/releases/download/v{{ prometheus_postgres_exporter_version }}/postgres_exporter-{{ prometheus_postgres_exporter_version }}.linux-amd64.tar.gz
|
||||
@ -19,22 +35,6 @@
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: 'prometheus | postgres exporter | configuration'
|
||||
copy:
|
||||
dest: '/var/lib/prometheus/.my.cnf'
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
backup: yes
|
||||
content: |
|
||||
[client]
|
||||
user={{ prometheus_postgres_exporter_user }}
|
||||
password={{ prometheus_postgres_exporter_password }}
|
||||
when:
|
||||
- prometheus_postgres_exporter_user is defined
|
||||
- prometheus_postgres_exporter_password is defined
|
||||
register: prometheus_postgres_exporter_configuration
|
||||
|
||||
- name: 'prometheus | postgresql exporter | configuration'
|
||||
copy:
|
||||
dest: '/etc/default/prometheus-postgres-exporter'
|
||||
@ -51,19 +51,6 @@
|
||||
- prometheus_postgres_exporter_host is defined
|
||||
- prometheus_postgres_exporter_port is defined
|
||||
register: prometheu_postgres_exporter_configuration
|
||||
notify:
|
||||
- 'prometheus | postgres exporter | restart service'
|
||||
|
||||
- name: 'prometheus | postgres exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-postgres-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-postgres-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
|
||||
- name: 'prometheus | postgres exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
name: prometheus-postgres-exporter.service
|
||||
|
Loading…
x
Reference in New Issue
Block a user