--- - name: Ensure /iscsidisk is mounted from serverd iSCSI target hosts: initiators become: true tasks: - name: the iSCSI initiator software installed yum: name: iscsi-initiator-utils state: present - name: the IQN is set for the initiator template: src: templates/initiatorname.iscsi.j2 dest: /etc/iscsi/initiatorname.iscsi owner: root group: root mode: 0640 notify: restart iscsid - meta: flush_handlers - name: the iSCSI target is discovered and available open_iscsi: portal: 172.25.250.13 port: '3260' target: iqn.2014-06.com.example:store1 discover: yes login: yes register: target - name: display the discovered devices debug: msg: "The new device is {{ target['devicenodes'][0] }}" - name: the new device is formatted and mounted under /iscsidisk include_role: name: rhel-system-roles.storage vars: storage_volumes: - name: devdata state: present type: disk disks: - "{{ target['devicenodes'][0] }}" mount_point: /iscsidisk fs_type: ext4 mount_options: '_netdev' handlers: - name: restart iscsid service: name: iscsid state: restarted