2023-01-27 20:34:33 +01:00
|
|
|
---
|
|
|
|
- name: 'proxmox exporter | check vars are defined'
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- prometheus_proxmox_exporter_user is defined
|
|
|
|
- prometheus_proxmox_exporter_password is defined
|
|
|
|
- prometheus_proxmox_exporter_node is defined
|
|
|
|
tags: ['prometheus_proxmox']
|
|
|
|
|
|
|
|
- name: 'proxmox exporter | install package through pip3'
|
|
|
|
pip:
|
|
|
|
name:
|
|
|
|
- prometheus-pve-exporter
|
|
|
|
executable: pip3
|
|
|
|
tags: ['prometheus_proxmox']
|
|
|
|
|
|
|
|
- name: 'proxmox exporter | configuration'
|
|
|
|
template:
|
|
|
|
src: conf/prometheus-proxmox-exporter.j2
|
|
|
|
dest: /etc/default/prometheus-proxmox-exporter
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0600
|
2023-02-06 18:16:46 +01:00
|
|
|
register: prometheus_proxmox_exporter_configuration
|
2023-01-27 20:34:33 +01:00
|
|
|
notify:
|
|
|
|
- 'prometheus | proxmox exporter | restart service'
|
|
|
|
tags: ['prometheus_proxmox']
|
|
|
|
|
2023-02-06 18:19:49 +01:00
|
|
|
- name: 'proxmox exporter | systemd | copy unit file'
|
2023-01-27 20:34:33 +01:00
|
|
|
template:
|
2023-02-06 18:18:57 +01:00
|
|
|
src: systemd/prometheus-proxmox-exporter.service.j2
|
2023-02-06 18:19:49 +01:00
|
|
|
dest: /etc/systemd/system/prometheus-proxmox-exporter.service
|
2023-01-27 20:34:33 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0600
|
|
|
|
notify:
|
2023-02-06 18:19:49 +01:00
|
|
|
- 'prometheus | proxmox exporter | restart service'
|
2023-02-06 18:16:46 +01:00
|
|
|
#when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
2023-01-27 20:34:33 +01:00
|
|
|
tags: ['prometheus_proxmox']
|
|
|
|
|
2023-02-06 18:19:49 +01:00
|
|
|
- name: 'proxmox exporter | systemd | enable service'
|
2023-01-27 20:34:33 +01:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
enabled: yes
|
|
|
|
name: prometheus-{{ exporter }}-exporter.service
|
|
|
|
ignore_errors: '{{ ansible_check_mode }}'
|
2023-02-06 18:16:46 +01:00
|
|
|
#when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
2023-01-27 20:34:33 +01:00
|
|
|
tags: ['prometheus_proxmox']
|