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.
 
 
 
 

58 lines
1.8 KiB

---
- when: "'overcloud' in group_names"
block:
- name: Check for docker cli
stat:
path: "/var/run/docker.sock"
register: check_docker_cli
check_mode: false
- name: Set oc_container_cli fact for the Overcloud nodes
set_fact:
oc_container_cli: |-
{% set oc_container_cli = 'podman' %}
{% if check_docker_cli.stat.exists|bool %}
{% set oc_container_cli = 'docker' %}
{% endif %}
{{ oc_container_cli }}
- when: "'Undercloud' in group_names"
block:
- name: Set container_cli fact from undercloud.conf
block:
- name: Ensure we get needed facts
setup:
gather_subset:
- '!all'
- '!any'
- '!min'
- env
- name: Get container client from undercloud.conf
validations_read_ini:
path: "{{ ansible_env.HOME }}/undercloud.conf"
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|137|142|143)\) .* ago")
loop: "{{ failed_containers.stdout_lines }}"