A collection of Ansible playbooks to detect and report potential issues during TripleO deployments
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
tripleo-validations/roles/container-status/tasks/main.yaml

45 lines
1.4 KiB

---
- name: Set oc_container_cli fact for the Overcloud nodes
set_fact:
oc_container_cli: "{{ hostvars[inventory_hostname].container_cli | default('podman', true) }}"
when:
- "'overcloud' in group_names"
- oc_container_cli is not defined
- when: "'Undercloud' in group_names"
block:
- name: Set container_cli fact from undercloud.conf
block:
- name: Get the path of tripleo undercloud config file
become: true
hiera:
name: "tripleo_undercloud_conf_file"
- name: Get container client from undercloud.conf
ini:
path: "{{ tripleo_undercloud_conf_file }}"
section: DEFAULT
key: container_cli
ignore_missing_file: true
register: container_cli
- name: Set uc_container_cli for the Undercloud
set_fact:
uc_container_cli: "{{ container_cli.value|default('podman', true) }}"
when: uc_container_cli is not defined
- name: Get failed containers for podman
changed_when: false
become: True
command: >
{% if oc_container_cli is defined %}{{ oc_container_cli }}{% else %}{{ uc_container_cli }}{% endif %}
{% raw %}
ps -a --filter 'status=exited' --format '{{ .Names }} {{ .Status }}'
{% endraw %}
register: failed_containers
- name: Fail if we detect failed containers
fail:
msg: "Failed container detected: {{ item }}."
when: item is not match(".* Exited \(0\) .* ago")
loop: "{{ failed_containers.stdout_lines }}"