Add prometheus role
Configured to include job definitions from /etc/prometheus/conf.d/*.yml.
This commit is contained in:
parent
f33a0b8a21
commit
d347fd7215
4 changed files with 31 additions and 0 deletions
3
roles/prometheus/README.md
Normal file
3
roles/prometheus/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Install and configure prometheus.
|
||||||
|
|
||||||
|
Job definitions should be placed in /etc/prometheus/conf.d by roles using this one.
|
2
roles/prometheus/files/prometheus.yml
Normal file
2
roles/prometheus/files/prometheus.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
scrape_config_files:
|
||||||
|
- "conf.d/*.yml"
|
5
roles/prometheus/handlers/main.yml
Normal file
5
roles/prometheus/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
- name: reload prometheus
|
||||||
|
service:
|
||||||
|
name: prometheus
|
||||||
|
state: reloaded
|
||||||
|
when: "'handler' not in ansible_skip_tags"
|
21
roles/prometheus/tasks/main.yml
Normal file
21
roles/prometheus/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
- name: Install packages
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- prometheus
|
||||||
|
|
||||||
|
- name: Create directory for prometheus configs
|
||||||
|
file:
|
||||||
|
path: /etc/prometheus/conf.d
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Configure prometheus
|
||||||
|
copy:
|
||||||
|
dest: /etc/prometheus/
|
||||||
|
src: prometheus.yml
|
||||||
|
notify: reload prometheus
|
||||||
|
|
||||||
|
- name: Enable prometheus service
|
||||||
|
service:
|
||||||
|
name: prometheus
|
||||||
|
enabled: true
|
||||||
|
state: started
|
Loading…
Add table
Add a link
Reference in a new issue