---
- name: Ensure inspection store container is stopped
  kayobe_container:
    name: "{{ item.value.container_name }}"
    state: "absent"
  with_dict: "{{ inspection_store_services }}"
  become: "{{ container_engine == 'podman' }}"

- name: Ensure inspection store volumes are absent
  kayobe_container_volume:
    name: "{{ volume }}"
    state: absent
  with_subelements:
    - "{{ inspection_store_services }}"
    - volumes
  when: "'/' not in volume"
  failed_when:
    - volume_result.rc != 0
    - "'no such volume' not in volume_result.stderr | lower"
  vars:
    volume: "{{ item.1.split(':')[0] }}"
  become: "{{ container_engine == 'podman' }}"
