Skip to content

open_iscsi doesn't work properly with target #10006

Open
@olred

Description

@olred

Summary

The module community.general.open_iscsi doesn't work properly in case:

    portal: '{{ iscsi_target }}'
    login: true
    discover: true
    rescan: true

In actual results, we can observe that no target was specified for parameter --targetname.
As I understood from source code of module it happens due to missing some code which was present in community.general versions before 9.5.0- link, now the target variable is initialized only manually via task parameter target.

Issue Type

Bug Report

Component Name

open_iscsi

Ansible Version

$ ansible --version
ansible [core 2.15.12]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.19 (main, Jun 11 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
/usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
# /usr/local/lib/python3.9/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.5.2  

# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 10.5.0

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

NAME="CentOS Stream"
VERSION="9"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="9"
PLATFORM_ID="platform:el9"
PRETTY_NAME="CentOS Stream 9"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:centos:centos:9"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://issues.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

Steps to Reproduce

1. Configure some iscsi portal(e.g via targetcli)
2. Run ansible community.general.open_iscsi task, where iscsi_target is IP:PORT iscsi node
- name: Discover targets on portal and login to the ones available
  community.general.open_iscsi:
    portal: '{{ iscsi_target }}'
    login: true
    discover: true
    rescan: true

Expected Results

Find out targets on specified iscsi portal and log into them

Actual Results

FAILED! => {"changed": false, "cmd": "/sbin/iscsiadm --mode node --targetname --login", "msg": "iscsiadm: No records found", "rc": 21, "stderr": "iscsiadm: No records found\n", "stderr_lines": ["iscsiadm: No records found"], "stdout": "", "stdout_lines": []}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugmodulemodule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions