ansible/roles/prometheus/tasks/main.yml
Alexandre Iooss 40d9108b37
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
prometheus: add iLO alert rules
2021-12-31 21:26:27 +01:00

71 lines
1.5 KiB
YAML

---
- name: Install Prometheus
apt:
update_cache: true
name:
- prometheus
- prometheus-snmp-exporter
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Configure Prometheus
template:
src: "{{ item }}.j2"
dest: "/etc/prometheus/{{ item }}"
owner: prometheus
group: prometheus
mode: u=r,g=r,o=
loop:
- prometheus.yml
notify: Restart Prometheus
- name: Creates directory for alerts
file:
path: /etc/prometheus/alerts
state: directory
owner: prometheus
group: prometheus
mode: 0755
- name: Configure Prometheus alerts
template:
src: "{{ item }}.j2"
dest: "/etc/prometheus/alerts/{{ item }}"
owner: prometheus
group: prometheus
mode: u=r,g=r,o=
loop:
- server.rules.yml
- docker.rules.yml
- ups.rules.yml
- postgres.rules.yml
- environmental.rules.yml
- ilo.rules.yml
notify: Restart Prometheus
- name: Make Prometheus snmp-exporter listen on localhost only
lineinfile:
path: /etc/default/prometheus-snmp-exporter
regexp: '^ARGS='
line: "ARGS=\"--web.listen-address=127.0.0.1:9116\""
notify: Restart prometheus-snmp-exporter
# These files store SNMP OIDs
- name: Configure Prometheus snmp-exporter
template:
src: "{{ item }}.j2"
dest: "/etc/prometheus/{{ item }}"
owner: prometheus
group: prometheus
mode: u=r,g=r,o=
loop:
- snmp.yml
notify: Restart prometheus-snmp-exporter
- name: Activate prometheus service
systemd:
name: prometheus
enabled: true
state: started
...