Browse Source

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)
changes/51/706851/1
Cédric Jeanneret 2 weeks ago
parent
commit
65545f3e4d
No account linked to committer's email address
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      roles/healthcheck_service_status/tasks/main.yml

+ 6
- 2
roles/healthcheck_service_status/tasks/main.yml 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 }}"

Loading…
Cancel
Save