mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
When there is OpenStack deployment, which doesn't have swift services, or there are no containers used at all, listing them will fail the playbook and leave exit code other than 0, which may interrupt CI. With this commit, errors from listing containers will be ignored, which will cover both cases.
23 lines
621 B
YAML
23 lines
621 B
YAML
# Required Python packages:
|
|
#
|
|
# ansible
|
|
# openstackclient
|
|
# openstacksdk
|
|
|
|
- ansible.builtin.import_playbook: common.yaml
|
|
|
|
- hosts: all
|
|
gather_facts: no
|
|
|
|
tasks:
|
|
- name: 'List the containers associated with the cluster'
|
|
ansible.builtin.command:
|
|
cmd: "openstack container list --prefix {{ os_infra_id }} -f value -c Name"
|
|
register: container_list
|
|
ignore_errors: true
|
|
|
|
- name: 'Delete the containers associated with the cluster'
|
|
ansible.builtin.command:
|
|
cmd: "openstack container delete -r {{ container_list.stdout }}"
|
|
when: container_list.rc == 0 and container_list.stdout|length > 0
|