17 lines
434 B
YAML
17 lines
434 B
YAML
---
|
|
- name: get failed systemd units
|
|
shell: >
|
|
systemctl list-units --failed --plain --no-legend --no-pager |
|
|
awk '{print $1}'
|
|
register: systemd_status
|
|
changed_when: false
|
|
|
|
- name: Fails if we find failed units
|
|
assert:
|
|
fail_msg: >
|
|
Failed units were found: {{ systemd_status.stdout_lines|join(',') }}
|
|
success_msg: >
|
|
No failed unit were found
|
|
that:
|
|
- systemd_status.stdout_lines|length == 0
|