Browse Source

Stop and remove container with module

For stopping and removing podman container use podman_container
modules which is idempotent. Retry it a few times if it doesn't
pass first time.

Partial-Bug: #1876893
Change-Id: Ic9f063eac866b25f980f20f86502653289321592
changes/42/725942/2
Sagi Shnaidman 2 years ago
parent
commit
14dc45d7cd
  1. 20
      tripleo_ansible/roles/tripleo_container_rm/tasks/tripleo_podman_container_rm.yml

20
tripleo_ansible/roles/tripleo_container_rm/tasks/tripleo_podman_container_rm.yml

@ -78,15 +78,11 @@
systemd:
daemon_reload: true
- name: "stat {{ container }} container"
command: "podman container exists {{ container }}"
failed_when: false
changed_when: false
register: stat_container
- name: Stop and remove container
command: "podman container rm --force {{ container }}"
changed_when: true
when:
- stat_container.rc is defined
- stat_container.rc == 0
- name: Stop and remove container if exists
podman_container:
name: "{{ container }}"
state: absent
register: result
until: result is success
retries: 5
delay: 10

Loading…
Cancel
Save