ansible/roles/prometheus_node/tasks/main.yml

40 lines
1.1 KiB
YAML
Raw Permalink Normal View History

2019-05-05 14:07:04 +02:00
---
- name: Install Prometheus node-exporter
apt:
update_cache: true
name: prometheus-node-exporter
2019-11-01 14:16:32 +01:00
install_recommends: false # Do not install smartmontools
2019-05-05 14:07:04 +02:00
register: apt_result
retries: 3
until: apt_result is succeeded
2019-11-01 14:16:32 +01:00
when:
- ansible_lsb.codename == 'buster'
# Prometheus 2 node is in stretch-backports
- name: Install Prometheus node-exporter (stretch-backports)
apt:
update_cache: true
name: prometheus-node-exporter
install_recommends: false
default_release: stretch-backports
register: apt_result
retries: 3
until: apt_result is succeeded
when:
- ansible_lsb.codename == 'stretch'
2019-07-22 20:56:43 +02:00
- name: Activate prometheus-node-exporter service
systemd:
name: prometheus-node-exporter
2019-07-22 21:04:58 +02:00
enabled: true
2019-07-22 20:56:43 +02:00
state: started
2019-11-01 14:16:32 +01:00
# Doesn't work on Debian Stretch with the old prometheus package
- name: Make Prometheus node-exporter listen on adm only
lineinfile:
path: /etc/default/prometheus-node-exporter
regexp: '^ARGS='
2019-11-01 14:16:32 +01:00
line: |
ARGS="--web.listen-address={{ ansible_hostname }}.adm.auro.re:9100"
notify: Restart prometheus-node-exporter