ansible/roles/pve_exporter/tasks/main.yml

49 lines
1 KiB
YAML

---
- name: pip installieren
apt:
name: python3-pip
state: present
- name: pve_exporter installieren
pip:
name: prometheus-pve-exporter
state: present
extra_args: --break-system-packages
- name: Config-Verzeichnis
file:
path: /etc/pve_exporter
state: directory
mode: '0700'
- name: Config deployen
template:
src: pve.yml.j2
dest: /etc/pve_exporter/pve.yml
mode: '0600'
notify: pve_exporter neustarten
- name: Systemd Service
copy:
dest: /etc/systemd/system/pve-exporter.service
content: |
[Unit]
Description=Prometheus PVE Exporter
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/pve_exporter --config.file /etc/pve_exporter/pve.yml --web.listen-address 0.0.0.0:{{ pve_exporter_port }}
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
notify: pve_exporter neustarten
- name: Service aktivieren und starten
systemd:
name: pve-exporter
enabled: true
state: started
daemon_reload: true