24 lines
889 B
YAML
24 lines
889 B
YAML
---
|
|
- name: Make sure the container {{ container }} is stopped even if container_cli do not match
|
|
become: true
|
|
shell: |-
|
|
# We need to make sure that containers are stopped
|
|
# as we might have different CLIs to interact with
|
|
# them. I.e the container_cli might be setted to be podman
|
|
# but we might have the containers running with docker.
|
|
set -eu
|
|
if command -v podman && podman exec {{ container }} /bin/true; then
|
|
if systemctl status {{ container }}.service; then
|
|
systemctl stop {{ container }}.service
|
|
else
|
|
podman kill {{ container }}
|
|
fi
|
|
fi
|
|
if type docker &> /dev/null && docker exec {{ container }} /bin/true; then
|
|
docker stop {{ container }}
|
|
fi
|
|
delegate_to: "{{ tripleo_delegate_to_item }}"
|
|
with_items: "{{ tripleo_delegate_to }}"
|
|
loop_control:
|
|
loop_var: tripleo_delegate_to_item
|