Update file main.yml

This commit is contained in:
Administrator 2025-11-18 07:23:34 +00:00
parent 0e4f3ab50f
commit f2b83e9d00

View File

@ -100,8 +100,6 @@
mode: '0600'
become: yes
# УБИРАЕМ проверку с --test (она не поддерживается)
- name: Create pve_exporter systemd service
copy:
content: |
@ -137,34 +135,30 @@
daemon_reload: yes
become: yes
- name: Wait for service to initialize
pause:
seconds: 10
- name: Wait for pve_exporter to initialize
wait_for:
host: localhost
port: 9223
timeout: 30
state: started
delay: 5
become: yes
failed_when: false
register: port_check
# Проверяем статус сервиса
- name: Check pve_exporter service status
command: systemctl status pve_exporter
register: service_status
changed_when: false
become: yes
# Если сервис не активен - показываем логи
- name: Show pve_exporter logs
- name: Show logs if service failed
command: journalctl -u pve_exporter --since "5 minutes ago" --no-pager
register: service_logs
changed_when: false
when: "'Active: failed' in service_status.stdout or 'Active: inactive' in service_status.stdout"
when: port_check.failed or "'Active: failed' in service_status.stdout"
become: yes
# Проверяем открытые порты
- name: Check listening ports
command: ss -tlnp | grep ':9223'
register: port_status
changed_when: false
become: yes
# Финальная проверка
- name: Verify exporter is responding
uri:
url: http://localhost:9223/metrics
@ -172,4 +166,5 @@
timeout: 10
register: metrics_check
failed_when: metrics_check.status != 200
when: not port_check.failed
become: yes