Better task name and loop control

Previous patch[1] wanted to make things easier to read, but it didn't
work as expected. The current change should allow a better readability
of the check task.

[1] https://review.opendev.org/691826

Change-Id: I0c41ec100a42a9fc4520c3bf8069a6ec45d054c7
(cherry picked from commit 153001ed1a)
This commit is contained in:
Cédric Jeanneret 2020-02-03 13:23:16 +01:00 committed by Gael Chamoulaud (Strider)
parent d1e812640c
commit 65545f3e4d
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
1 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,7 @@
{{ healthcheck_services_list.stdout_lines }}
{%- endif -%}
- name: "[Healthcheck] Get {{ item }} status"
- name: Get healthcheck status
systemd:
name: "{{ item }}"
retries: "{{ retries_number|int }}"
@ -25,10 +25,14 @@
- systemd_healthcheck_state.status.ActiveState in ['inactive', 'failed']
ignore_errors: true
register: systemd_healthcheck_state
with_items: "{{ hc_services }}"
loop: "{{ hc_services }}"
loop_control:
label: "{{ item }}"
- name: Fail if systemd healthcheck services are in failed status
fail:
msg: "Failed systemd healthcheck service detected: {{ item.item }}"
when: item.status.ExecMainStatus != '0'
loop: "{{ systemd_healthcheck_state.results }}"
loop_control:
label: "{{ item.item }}"