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

- name: Check whether OpenSM volumes are absent
  kayobe_container_volume:
    name: "{{ volume }}"
    state: absent
  changed_when: False
  with_subelements:
    - "{{ opensm_services }}"
    - volumes
  when: "'/' not in volume"
  vars:
    volume: "{{ item.1.split(':')[0] }}"
  become: "{{ container_engine == 'podman' }}"
