60 lines
1.9 KiB
YAML
60 lines
1.9 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 | create dedicated venv path'
|
||
file:
|
||
path: "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
|
||
state: directory
|
||
tags: ['prometheus_proxmox']
|
||
|
||
- name: 'proxmox exporter | create dedicated venv'
|
||
command:
|
||
cmd: python3 -m venv "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
|
||
tags: ['prometheus_proxmox']
|
||
|
||
- name: 'proxmox exporter | install package through pip3'
|
||
pip:
|
||
name:
|
||
- prometheus-pve-exporter
|
||
venv: "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
|
||
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']
|