cisco.intersight.intersight_iscsi_static_target_policy module – Manage iSCSI Static Target Policies for Cisco Intersight

Note

This module is part of the cisco.intersight collection (version 2.6.0).

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 cisco.intersight.

To use it in a playbook, specify: cisco.intersight.intersight_iscsi_static_target_policy.

Synopsis

  • Create, update, and delete iSCSI Static Target Policies on Cisco Intersight.

  • iSCSI static target policy enables you to configure the iSCSI targets for iSCSI vNIC interfaces.

  • For more information see Cisco Intersight.

Parameters

Parameter

Comments

api_key_id

string / required

Public API Key ID associated with the private key.

If not set, the value of the INTERSIGHT_API_KEY_ID environment variable is used.

api_private_key

path / required

Filename (absolute path) or string of PEM formatted private key data to be used for Intersight API authentication.

If a string is used, Ansible vault should be used to encrypt string data.

Ex. ansible-vault encrypt_string --vault-id tme@/Users/dsoper/Documents/vault_password_file ‘-----BEGIN EC PRIVATE KEY-----

<your private key data>

-----END EC PRIVATE KEY-----’

If not set, the value of the INTERSIGHT_API_PRIVATE_KEY environment variable is used.

api_uri

string

URI used to access the Intersight API.

If not set, the value of the INTERSIGHT_API_URI environment variable is used.

Default: "https://intersight.com/api/v1"

description

aliases: descr

string

The user-defined description for the iSCSI Static Target Policy.

Description can contain letters(a-z, A-Z), numbers(0-9), hyphen(-), period(.), colon(:), or an underscore(_).

ip_protocol

string

Type of the IP address requested for iSCSI vNIC.

IPv4 or IPv6.

Required when state is present.

Choices:

  • "IPv4"

  • "IPv6"

ipv4_address

string

The IPv4 address assigned to the iSCSI target.

Required when ip_protocol is IPv4 and state is present.

ipv6_address

string

The IPv6 address assigned to the iSCSI target.

Required when ip_protocol is IPv6 and state is present.

lun_id

integer

The Logical Unit Number (LUN) Identifier for the iSCSI target.

Valid values are 0 or greater (typically 0-255).

Required when state is present.

name

string / required

The name assigned to the iSCSI Static Target Policy.

Must be unique within the organization.

The name must be between 1 and 62 alphanumeric characters, allowing special characters :-_.

organization

string

The name of the Organization this resource is assigned to.

Policies created within a Custom Organization are applicable only to devices in the same Organization.

Use ‘default’ for the default organization.

Default: "default"

port

integer

The port associated with the iSCSI target.

Valid range is 1-65535.

Common iSCSI port is 3260.

Required when state is present.

state

string

If present, will verify the resource is present and will create if needed.

If absent, will verify the resource is absent and will delete if needed.

Choices:

  • "present" ← (default)

  • "absent"

tags

list / elements=dictionary

List of tags in Key:<user-defined key> Value:<user-defined value> format.

target_name

string

Qualified Name (IQN) or Extended Unique Identifier (EUI) name of the iSCSI target.

This is the name that uniquely identifies the target in the iSCSI network.

Example IQN format - iqn.1991-05.com.microsoft:winclient1

Example EUI format - eui.02004567A425678D

Required when state is present.

use_proxy

boolean

If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.

Choices:

  • false

  • true ← (default)

validate_certs

boolean

Boolean control for verifying the api_uri TLS certificate

Choices:

  • false

  • true ← (default)

Examples

- name: Create an iSCSI Static Target Policy with IPv4
  cisco.intersight.intersight_iscsi_static_target_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: "default"
    name: "iscsi-static-target-policy-01"
    description: "iSCSI static target policy for production servers"
    target_name: "iqn.1991-05.com.microsoft:winclient1"
    port: 3260
    lun_id: 0
    ip_protocol: "IPv4"
    ipv4_address: "192.168.10.100"
    tags:
      - Key: "Environment"
        Value: "Production"
      - Key: "Owner"
        Value: "Storage-Team"
    state: present

- name: Create an iSCSI Static Target Policy with IPv6
  cisco.intersight.intersight_iscsi_static_target_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: "default"
    name: "iscsi-static-target-policy-ipv6"
    description: "iSCSI static target policy with IPv6 addressing"
    target_name: "iqn.2001-04.com.example:storage.disk2"
    port: 3260
    lun_id: 1
    ip_protocol: "IPv6"
    ipv6_address: "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
    state: present

- name: Update an existing iSCSI Static Target Policy
  cisco.intersight.intersight_iscsi_static_target_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "iscsi-static-target-policy-01"
    description: "Updated description for iSCSI target policy"
    target_name: "iqn.1991-05.com.microsoft:winclient1"
    port: 3260
    lun_id: 2
    ip_protocol: "IPv4"
    ipv4_address: "192.168.10.101"
    state: present

- name: Delete an iSCSI Static Target Policy
  cisco.intersight.intersight_iscsi_static_target_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "iscsi-static-target-policy-01"
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

api_response

dictionary

The API response output returned by the specified resource.

Returned: always

Sample: {"api_response": {"IpAddress": "192.168.10.100", "IscsiIpType": "IPv4", "Lun": {"LunId": 0}, "Moid": "1234567890abcdef12345678", "Name": "iscsi-static-target-policy-01", "ObjectType": "vnic.IscsiStaticTargetPolicy", "Organization": {"Moid": "abcdef1234567890abcdef12", "ObjectType": "organization.Organization"}, "Port": 3260, "Tags": [{"Key": "Environment", "Value": "Production"}], "TargetName": "iqn.1991-05.com.microsoft:winclient1"}}

Authors

  • Ron Gershburg (@rgershbu)