ansible/roles/prometheus_ipmi/tasks/main.yml

66 lines
1.6 KiB
YAML
Raw Normal View History

2021-09-08 11:53:20 +02:00
---
- name: Install Prometheus ipmi-exporter
apt:
update_cache: true
name: prometheus-ipmi-exporter
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Make Prometheus ipmi-exporter scrap on localhost only
lineinfile:
path: /etc/default/prometheus-ipmi-exporter
regexp: '^ARGS='
line: |
ARGS="--config.file=/etc/prometheus/ipmi_local.yml --freeipmi.path='/etc/prometheus/ipmi_conf/'"
notify: Restart prometheus-ipmi-exporter
- name: Define prometheus to be sudo for some command
copy:
src: files/prometheus
dest: /etc/sudoers.d/prometheus
owner: root
group: root
mode: u=r,g=r,o=
notify: Restart prometheus-ipmi-exporter
- name: Override commands launchs by prometheus for ipmi
copy:
src: files/ipmi_conf
dest: /etc/prometheus
owner: prometheus
group: prometheus
mode: u=rx,g=r,o=
notify: Restart prometheus-ipmi-exporter
- name: Override commands launchs by prometheus for ipmi
file:
src: '/etc/prometheus/ipmi_conf/ipmi.sh'
dest: '/etc/prometheus/ipmi_conf/{{ item }}'
state: link
2021-09-08 18:50:57 +02:00
force: true
2021-09-08 11:53:20 +02:00
owner: prometheus
group: prometheus
mode: u=rx,g=,o=
loop:
- bmc-info
- ipmi-chassis
- ipmi-dcmi
- ipmimonitoring
- ipmi-raw
- ipmi-sensors
- ipmi-sel
2021-09-08 11:53:20 +02:00
notify: Restart prometheus-ipmi-exporter
- name: Activate prometheus-ipmi-exporter service
systemd:
name: prometheus-ipmi-exporter
enabled: true
state: started
- name: Restart prometheus-ipmi-exporter
systemd:
state: restarted
2021-09-08 18:50:57 +02:00
daemon_reload: true
2021-09-08 11:53:20 +02:00
name: prometheus-ipmi-exporter