153001ed1a
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
39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
---
|
|
- name: Get the healthcheck services list enabled on node
|
|
shell: >
|
|
systemctl list-unit-files | grep "^tripleo.*healthcheck.*enabled" | awk -F'.' '{print $1}'
|
|
changed_when: false
|
|
register: healthcheck_services_list
|
|
when: inflight_healthcheck_services | length < 1
|
|
|
|
- name: Set hc_services
|
|
set_fact:
|
|
hc_services: >
|
|
{%- if inflight_healthcheck_services | length > 0 -%}
|
|
{{ inflight_healthcheck_services }}
|
|
{%- else -%}
|
|
{{ healthcheck_services_list.stdout_lines }}
|
|
{%- endif -%}
|
|
|
|
- name: Get healthcheck status
|
|
systemd:
|
|
name: "{{ item }}"
|
|
retries: "{{ retries_number|int }}"
|
|
delay: "{{ delay_number|int }}"
|
|
until:
|
|
- systemd_healthcheck_state.status.ExecMainPID != '0'
|
|
- systemd_healthcheck_state.status.ActiveState in ['inactive', 'failed']
|
|
ignore_errors: true
|
|
register: systemd_healthcheck_state
|
|
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 }}"
|