Ivan Halomi 7a9f04573a Adding container engine to kolla_container_facts
Second part of patchset:
https://review.opendev.org/c/openstack/kolla-ansible/+/799229/
in which was suggested to split patch into smaller ones.

This change adds container_engine variable to kolla_container_facts
module, this prepares module to be used with docker and podman as well
without further changes in roles.

Signed-off-by: Ivan Halomi <i.halomi@partner.samsung.com>
Co-authored-by: Martin Hiner <m.hiner@partner.samsung.com>
Change-Id: I9e8fa30646844ab4a288555f3aafdda345b3a118
2022-11-02 13:44:45 +01:00

35 lines
1.0 KiB
YAML

---
- block:
- name: Check if bifrost_deploy container is running
become: true
kolla_container_facts:
container_engine: "{{ kolla_container_engine }}"
name:
- bifrost_deploy
register: container_facts
- block:
# Ensure that all services are stopped gracefully, and in a sensible
# order.
- name: Stop services gracefully
become: true
command: "{{ kolla_container_engine }} exec bifrost_deploy systemctl stop {{ item }}.service"
with_items:
- ironic
- ironic-inspector
- mariadb
- nginx
- name: Stopping bifrost_deploy container
become: true
kolla_docker:
action: "stop_container"
common_options: "{{ docker_common_options }}"
name: "bifrost_deploy"
when: "'bifrost_deploy' in container_facts"
when:
- inventory_hostname in groups['bifrost']
- "'bifrost_deploy' not in skip_stop_containers"