ansible.builtin.open_iscsi (v2.9.27) — module

Manage iSCSI targets with Open-iSCSI

| "added in version" 1.4 of ansible.builtin"

Authors: Serge van Ginderachter (@srvg)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disconnect from the cached named target
  open_iscsi:
    login: no
    target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d

Inputs

    
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