Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions roles/blackbox_exporter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@
enabled: true
tags:
- blackbox_exporter_run

- name: Display service errors
ansible.builtin.include_role:
name: service_debug
vars:
__service_name: blackbox_exporter
27 changes: 27 additions & 0 deletions roles/service_debug/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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

...
6 changes: 6 additions & 0 deletions roles/smokeping_prober/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@
- not ansible_check_mode
tags:
- smokeping_prober_run

- name: Display service errors
ansible.builtin.include_role:
name: service_debug
vars:
__service_name: smokeping_prober
Loading