enhancement: add service debug role to catch and display service errors

Signed-off-by: Christian Krause <christian.krause@idiv.de>
This commit is contained in:
Christian Krause 2023-12-15 11:31:51 +01:00
parent 9c6c96e188
commit efd9292dc8
No known key found for this signature in database
GPG key ID: 3CD613B9A8567F58
3 changed files with 39 additions and 0 deletions

View file

@ -41,3 +41,9 @@
enabled: true enabled: true
tags: tags:
- blackbox_exporter_run - blackbox_exporter_run
- name: Display service errors
ansible.builtin.include_role:
name: service_debug
vars:
__service_name: blackbox_exporter

View file

@ -0,0 +1,27 @@
---
- name: 'Run `systemctl status {{ __service_name }}`'
ansible.builtin.command: 'systemctl status {{ __service_name }}.service'
changed_when: false
failed_when: false
register: __service_status
- name: 'Show `systemctl status` output for {{ __service_name }}'
ansible.builtin.debug:
var: __service_status.stdout_lines
changed_when: false
failed_when: false
- name: 'Run `journalctl -x -u {{ __service_name }}`'
ansible.builtin.command: 'journalctl -x -u {{ __service_name }}.service'
changed_when: false
failed_when: false
register: __service_journal
- name: 'Show `journalctl -x` output for {{ __service_name }}'
ansible.builtin.debug:
var: __service_journal.stdout_lines
changed_when: false
failed_when: false
...

View file

@ -61,3 +61,9 @@
- not ansible_check_mode - not ansible_check_mode
tags: tags:
- smokeping_prober_run - smokeping_prober_run
- name: Display service errors
ansible.builtin.include_role:
name: service_debug
vars:
__service_name: smokeping_prober