proxmox - install into venv

This commit is contained in:
Ludovic Cartier 2024-04-24 17:37:33 +02:00
parent 834b1a6d5e
commit 52b7b73a25
3 changed files with 15 additions and 2 deletions

View File

@ -70,6 +70,8 @@ prometheus_postgres_exporter_user: "postgres"
prometheus_postgres_exporter_password: "changeme_" prometheus_postgres_exporter_password: "changeme_"
prometheus_postgres_exporter_port: 5432 prometheus_postgres_exporter_port: 5432
prometheus_proxmox_venv_path: "/opt/venv/prometheus-pve-exporter"
prometheus_redis_exporter_addr: "redis://localhost:6379" prometheus_redis_exporter_addr: "redis://localhost:6379"
prometheus_redis_exporter_user: "" prometheus_redis_exporter_user: ""
prometheus_redis_exporter_password: "" prometheus_redis_exporter_password: ""

View File

@ -7,11 +7,22 @@
- prometheus_proxmox_exporter_node is defined - prometheus_proxmox_exporter_node is defined
tags: ['prometheus_proxmox'] 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' - name: 'proxmox exporter | install package through pip3'
pip: pip:
name: name:
- prometheus-pve-exporter - prometheus-pve-exporter
executable: pip3 venv: "{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"
tags: ['prometheus_proxmox'] tags: ['prometheus_proxmox']
- name: 'proxmox exporter | configuration' - name: 'proxmox exporter | configuration'

View File

@ -5,6 +5,6 @@ Wants=network.target
[Service] [Service]
Restart=on-failure Restart=on-failure
ExecStart=/usr/local/bin/pve_exporter --config.file /etc/default/prometheus-proxmox-exporter --web.listen-address {{ prometheus_proxmox_exporter_node }}:{{ prometheus_proxmox_exporter_port | default('9221') }} ExecStart="{{ prometheus_proxmox_venv_path | default('/opt/venv/prometheus-pve-exporter') }}"/bin/pve_exporter --config.file /etc/default/prometheus-proxmox-exporter --web.listen-address {{ prometheus_proxmox_exporter_node }}:{{ prometheus_proxmox_exporter_port | default('9221') }}
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target