ansible/roles/prometheus-snmp-exporter/tasks/main.yml

31 lines
795 B
YAML

---
- name: Install Prometheus SNMP exporter
apt:
update_cache: true
name: prometheus-snmp-exporter
register: apt_result
retries: 3
until: apt_result is succeeded
- 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
# This file store SNMP OIDs
- name: Configure Prometheus SNMP exporter
template:
src: "prometheus/snmp.yml.j2"
dest: "/etc/prometheus/snmp.yml"
mode: 0600
owner: prometheus
notify: Restart prometheus-snmp-exporter
- name: Activate prometheus SNMP exporter service
systemd:
name: prometheus-snmp-exporter
enabled: true
state: started