community / community.general / 0.1.1 / module / open_iscsi Manage iSCSI targets with Open-iSCSI Authors: Serge van Ginderachter (@srvg) preview | supported by communitycommunity.general.open_iscsi (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
Discover targets on given portal, (dis)connect targets, mark targets to manually or auto start, return device nodes of connected targets.
- name: Perform a discovery on 10.1.2.3 and show available target nodes open_iscsi: show_nodes: yes discover: yes portal: 10.1.2.3
# NOTE: Only works if exactly one target is exported to the initiator - name: Discover targets on portal and login to the one available open_iscsi: portal: '{{ iscsi_target }}' login: yes discover: yes
- name: Connect to the named target, after updating the local persistent database (cache) open_iscsi: login: yes target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d
- name: Disconnect from the cached named target open_iscsi: login: no target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d
port: default: 3260 description: - The port on which the iSCSI target process listens. type: str login: aliases: - state description: - Whether the target node should be connected. type: bool portal: aliases: - ip description: - The IP address of the iSCSI target. type: str target: aliases: - name - targetname description: - The iSCSI target name. type: str discover: description: - Whether the list of target nodes on the portal should be (re)discovered and added to the persistent iSCSI database. - Keep in mind that C(iscsiadm) discovery resets configuration, like C(node.startup) to manual, hence combined with C(auto_node_startup=yes) will always return a changed state. type: bool node_auth: default: CHAP description: - The value for C(discovery.sendtargets.auth.authmethod). type: str node_pass: description: - The value for C(discovery.sendtargets.auth.password). type: str node_user: description: - The value for C(discovery.sendtargets.auth.username). type: str show_nodes: description: - Whether the list of nodes in the persistent iSCSI database should be returned by the module. type: bool auto_node_startup: aliases: - automatic description: - Whether the target node should be automatically connected at startup. type: bool