blob: 9cb17ad09e281bd0ff3d32cd86d8d2cc9a6ef1b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
---
# Check whether all necessary containers are running.
- name: "Get container facts for {{ kolla_role_name | default(project_name) }}"
become: true
kolla_container_facts:
action: get_containers
container_engine: "{{ kolla_container_engine }}"
name: "{{ service_check_enabled_container_names }}"
register: container_facts
when: service_check_enabled_container_names | length > 0
- name: "Fail if containers are missing or not running for {{ kolla_role_name | default(project_name) }}"
vars:
missing_containers: >-
{{ service_check_enabled_container_names |
difference(container_facts.containers) |
list }}
ansible.builtin.fail:
msg: >
The following {{ kolla_role_name | default(project_name) }} containers are missing or not running:
{{ missing_containers | join(', ') }}
when:
- container_facts.containers is defined
- missing_containers | length > 0
- name: "Fail if containers are unhealthy for {{ kolla_role_name | default(project_name) }}"
vars:
unhealthy_containers: >-
{{ container_facts.containers |
dict2items |
selectattr("value.State.Health", "defined") |
selectattr("value.State.Health.Status", "search", "unhealthy") |
map(attribute='key') | list }}
ansible.builtin.fail:
msg: >
The following {{ kolla_role_name | default(project_name) }} containers are unhealthy:
{{ unhealthy_containers | join(', ') }}
when:
- container_facts.containers is defined
- unhealthy_containers | length > 0
|