community.general.open_iscsi (8.5.0) — module

Manage iSCSI targets with Open-iSCSI

Authors: Serge van Ginderachter (@srvg)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

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 sun.com and show available target nodes
  community.general.open_iscsi:
    show_nodes: true
    discover: true
    portal: sun.com
  • 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
  community.general.open_iscsi:
    show_nodes: true
    discover: true
    ip: 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
  community.general.open_iscsi:
    portal: '{{ iscsi_target }}'
    login: true
    discover: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Connect to the named target, after updating the local persistent database (cache)
  community.general.open_iscsi:
    login: true
    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
  community.general.open_iscsi:
    login: false
    target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Rescan one or all established sessions to discover new targets (omit target for all sessions)
  community.general.open_iscsi:
    rescan: true
    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 domain name or IP address of the iSCSI target.
    type: str

rescan:
    default: false
    description:
    - Rescan an established session for discovering new targets.
    - When O(target) is omitted, will rescan all sessions.
    type: bool
    version_added: 4.1.0
    version_added_collection: community.general

target:
    aliases:
    - name
    - targetname
    description:
    - The iSCSI target name.
    type: str

discover:
    default: false
    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 O(auto_node_startup=true) will always return a changed
      state.
    type: bool

node_auth:
    default: CHAP
    description:
    - The value for C(node.session.auth.authmethod).
    type: str

node_pass:
    description:
    - The value for C(node.session.auth.password).
    type: str

node_user:
    description:
    - The value for C(node.session.auth.username).
    type: str

show_nodes:
    default: false
    description:
    - Whether the list of nodes in the persistent iSCSI database should be returned by
      the module.
    type: bool

node_pass_in:
    description:
    - The value for C(node.session.auth.password_in).
    type: str
    version_added: 3.8.0
    version_added_collection: community.general

node_user_in:
    description:
    - The value for C(node.session.auth.username_in).
    type: str
    version_added: 3.8.0
    version_added_collection: community.general

auto_node_startup:
    aliases:
    - automatic
    description:
    - Whether the target node should be automatically connected at startup.
    type: bool

auto_portal_startup:
    description:
    - Whether the target node portal should be automatically connected at startup.
    type: bool
    version_added: 3.2.0
    version_added_collection: community.general