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']
|
|
|
|
|
2024-04-24 17:37:33 +02:00
|
|
|
- name: 'proxmox exporter | create dedicated venv path'
|
|
|
|
file:
|
2024-04-24 18:11:16 +02:00
|
|
|
path: "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
|
2024-04-24 17:37:33 +02:00
|
|
|
state: directory
|
|
|
|
tags: ['prometheus_proxmox']
|
|
|
|
|
|
|
|
- name: 'proxmox exporter | create dedicated venv'
|
|
|
|
command:
|
2024-04-24 18:11:16 +02:00
|
|
|
cmd: python3 -m venv "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
|
2024-04-24 17:37:33 +02:00
|
|
|
tags: ['prometheus_proxmox']
|
|
|
|
|
2023-01-27 20:34:33 +01:00
|
|
|
- name: 'proxmox exporter | install package through pip3'
|
|
|
|
pip:
|
|
|
|
name:
|
|
|
|
- prometheus-pve-exporter
|
2024-04-24 18:11:16 +02:00
|
|
|
venv: "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
|
2023-01-27 20:34:33 +01:00
|
|
|
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:
|
2023-02-10 11:13:37 +01:00
|
|
|
- 'proxmox-exporter-restart'
|
2023-01-27 20:34:33 +01:00
|
|
|
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-10 11:13:37 +01:00
|
|
|
- 'proxmox-exporter-restart'
|
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']
|