--- - name: Unmount stale iSCSI mounts ansible.builtin.mount: path: "{{ item.path | default(item) }}" state: unmounted loop: "{{ iscsi_absent_mounts | default([]) }}" loop_control: label: "{{ item.path | default(item) }}" tags: - iscsi_cleanup - name: Remove stale iSCSI fstab entries ansible.builtin.lineinfile: path: /etc/fstab state: absent regexp: "^\\\\S+\\\\s+{{ (item.path | default(item)) | regex_escape }}\\\\s+" loop: "{{ iscsi_absent_mounts | default([]) }}" loop_control: label: "{{ item.path | default(item) }}" tags: - iscsi_cleanup - name: Mount filesystems for iSCSI targets ansible.builtin.include_tasks: iscsi_mount.yml loop: "{{ iscsi_targets | default([]) | map(attribute='mounts') | list | flatten }}" loop_control: loop_var: m - name: Guardrail - ensure required mountpoints are mounted ansible.builtin.command: "findmnt -n {{ item.path }}" register: _findmnt changed_when: false failed_when: _findmnt.rc != 0 loop: "{{ iscsi_targets | default([]) | map(attribute='mounts') | list | flatten }}" loop_control: label: "{{ item.path }}"