W3cubDocs

/Ansible

community.general.open_iscsi – Manage iSCSI targets with Open-iSCSI

Note

This plugin is part of the community.general collection (version 3.8.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.open_iscsi.

Synopsis

  • Discover targets on given portal, (dis)connect targets, mark targets to manually or auto start, return device nodes of connected targets.

Requirements

The below requirements are needed on the host that executes this module.

  • open_iscsi library and tools (iscsiadm)

Parameters

Parameter Choices/Defaults Comments
auto_node_startup
boolean
    Choices:
  • no
  • yes
Whether the target node should be automatically connected at startup.

aliases: automatic
auto_portal_startup
boolean
added in 3.2.0 of community.general
    Choices:
  • no
  • yes
Whether the target node portal should be automatically connected at startup.
discover
boolean
    Choices:
  • no
  • yes
Whether the list of target nodes on the portal should be (re)discovered and added to the persistent iSCSI database.
Keep in mind that iscsiadm discovery resets configuration, like node.startup to manual, hence combined with auto_node_startup=yes will always return a changed state.
login
boolean
    Choices:
  • no
  • yes
Whether the target node should be connected.

aliases: state
node_auth
string
Default:
"CHAP"
The value for node.session.auth.authmethod.
node_pass
string
The value for node.session.auth.password.
node_pass_in
string
added in 3.8.0 of community.general
The value for node.session.auth.password_in.
node_user
string
The value for node.session.auth.username.
node_user_in
string
added in 3.8.0 of community.general
The value for node.session.auth.username_in.
port
string
Default:
3260
The port on which the iSCSI target process listens.
portal
string
The domain name or IP address of the iSCSI target.

aliases: ip
show_nodes
boolean
    Choices:
  • no
  • yes
Whether the list of nodes in the persistent iSCSI database should be returned by the module.
target
string
The iSCSI target name.

aliases: name, targetname

Examples

- name: Perform a discovery on sun.com and show available target nodes
  community.general.open_iscsi:
    show_nodes: yes
    discover: yes
    portal: sun.com

- name: Perform a discovery on 10.1.2.3 and show available target nodes
  community.general.open_iscsi:
    show_nodes: yes
    discover: yes
    ip: 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
  community.general.open_iscsi:
    portal: '{{ iscsi_target }}'
    login: yes
    discover: yes

- name: Connect to the named target, after updating the local persistent database (cache)
  community.general.open_iscsi:
    login: yes
    target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d

- name: Disconnect from the cached named target
  community.general.open_iscsi:
    login: no
    target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d

- name: Override and disable automatic portal login on specific portal
  community.general.open_iscsi:
    login: false
    portal: 10.1.1.250
    auto_portal_startup: false
    target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d

Authors

  • Serge van Ginderachter (@srvg)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/open_iscsi_module.html