Wait for ISCSI File System

Hello,

I am running some plays on a RHEL-HA cluster. The ISCSI shared storage is mounted with pacemaker. For the plays I am using pacemaker to move the file system between nodes. Is there a good way to enure the ISCSI filesystem is mounted before continuing? The ansible.posix.mount is not being used becuase pacemaker needs to control the mounting.

The current path I am headed down is write a text file on the shared storage then use the ansible.builtin.wait_for module to wait until a string is found in the text file. Seems like a potential short term solution. There must be something better though.

Another potential path is using the command mountpoint /iscsi. In the output below the command is run against all three nodes in the cluster. It seems like there should be a way for the ansible.builtin.wait_for module to wait for a zero return code, but I don’t see it.

ansible beta_cluster -b -a 'mountpoint /iscsi'

node3 | FAILED | rc=1 >>
/iscsi is not a mountpointnon-zero return code

node1 | FAILED | rc=1 >>
/iscsi is not a mountpointnon-zero return code

node2 | CHANGED | rc=0 >>
/iscsi is a mountpoint

Thank you

The path of waiting for a file on the shared storage did work.

   - name: Check if /iscsi is mounted
      ansible.builtin.wait_for:
        path: /iscsi/testmount.txt
        state: present
        timeout: 20

Seems like there is a better way though.