prometheus/tasks/exporter/proxmox.yml

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