- name: Run lvs
  ansible.builtin.command: lvs --select 'vg_name = {{ volume_group }} && lv_name = {{ volume_name }}_{{ snapshot_set_name }}' --reportformat json
  register: lvs_response
  changed_when: false

- name: Parse report
  ansible.builtin.set_fact:
    lv_snapshot_report_array: "{{ (lvs_response.stdout | from_json).report[0].lv }}"

- name: Verify that the snapshot no longer exists
  ansible.builtin.assert:
    that: (lv_snapshot_report_array | length) == 0
    fail_msg: >
      The snapshot '{{ volume_name }}_{{ snapshot_set_name }}'' for
      volume '{{ volume_name }}' in volume group '{{ volume_group }}'
      still exists
