prometheus/tasks/exporter/proxmox.yml
2023-02-06 18:16:46 +01:00

49 lines
1.4 KiB
YAML

---
- 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
register: prometheus_proxmox_exporter_configuration
notify:
- 'prometheus | proxmox exporter | restart service'
tags: ['prometheus_proxmox']
- name: 'promox exporter | systemd | copy unit file'
template:
src: systemd/prometheus-promox-exporter.service.j2
dest: /etc/systemd/system/prometheus-promox-exporter.service
owner: root
group: root
mode: 0600
notify:
- 'prometheus | promox exporter | restart service'
#when: not stat_result.stat.exists or exporter_upgrade == "yes"
tags: ['prometheus_proxmox']
- name: 'promox exporter | systemd | enable service'
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-{{ exporter }}-exporter.service
ignore_errors: '{{ ansible_check_mode }}'
#when: not stat_result.stat.exists or exporter_upgrade == "yes"
tags: ['prometheus_proxmox']