cisco.intersight.intersight_vsan_policy module – Manage VSAN Policies and VSANs 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_vsan_policy.

Synopsis

  • Create, update, and delete VSAN (Virtual Storage Area Network) Policies on Cisco Intersight.

  • 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 VSAN Policy.

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

enable_trunking

boolean

Enable or disable VSAN trunking on the policy.

When enabled, allows multiple VSANs to be carried over a single physical link.

Choices:

  • false ← (default)

  • true

name

string / required

The name assigned to the VSAN 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"

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.

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)

vsans

list / elements=dictionary

List of VSANs to be created and attached to the VSAN policy.

Each VSAN represents a virtual SAN segment.

Leave empty to create a policy without VSANs for manual configuration later.

fcoe_vlan_id

integer

FCoE VLAN ID associated with the VSAN configuration.

Must be between 2 and 4093.

VLAN IDs from 4043-4047, 4094, and 4095 are reserved for system use.

Required when state is present.

name

string / required

User-defined name for the VSAN configuration.

Must be unique within the VSAN policy.

state

string

Whether to create/update or delete the VSAN.

Choices:

  • "present" ← (default)

  • "absent"

vsan_id

integer

Virtual SAN Identifier in the switch.

Valid range is typically 1-4094.

Must be unique within the fabric interconnect domain.

Required when state is present.

vsan_scope

string

Indicates whether the VSAN ID is defined for storage or uplink or both traffics in FI.

Required when state is present.

Choices:

  • "uplink"

  • "storage"

  • "common"

Examples

- name: Create a VSAN Policy with multiple VSANs
  cisco.intersight.intersight_vsan_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: "default"
    name: "datacenter-vsan-policy"
    description: "VSAN policy for datacenter SAN infrastructure"
    enable_trunking: false
    tags:
      - Key: "Environment"
        Value: "Production"
      - Key: "Site"
        Value: "DataCenter-A"
    vsans:
      - name: "vsan_uplink_100"
        vsan_id: 100
        fcoe_vlan_id: 100
        vsan_scope: "uplink"
      - name: "vsan_storage_200"
        vsan_id: 200
        fcoe_vlan_id: 200
        vsan_scope: "storage"
      - name: "vsan_common_300"
        vsan_id: 300
        fcoe_vlan_id: 300
        vsan_scope: "common"
    state: present

- name: Create a VSAN Policy with trunking enabled
  cisco.intersight.intersight_vsan_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: "default"
    name: "trunked-vsan-policy"
    description: "VSAN policy with trunking enabled"
    enable_trunking: true
    vsans:
      - name: "vsan_fabric_a"
        vsan_id: 10
        fcoe_vlan_id: 10
        vsan_scope: "common"
      - name: "vsan_fabric_b"
        vsan_id: 20
        fcoe_vlan_id: 20
        vsan_scope: "common"
    state: present

- name: Create a VSAN Policy without VSANs (for manual configuration)
  cisco.intersight.intersight_vsan_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: "Engineering"
    name: "empty-vsan-policy"
    description: "Empty policy for manual VSAN configuration"
    enable_trunking: false
    state: present

- name: Update an existing VSAN Policy
  cisco.intersight.intersight_vsan_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "datacenter-vsan-policy"
    description: "Updated description for datacenter SAN infrastructure"
    enable_trunking: true
    tags:
      - Key: "Environment"
        Value: "Production"
      - Key: "Site"
        Value: "DataCenter-A"
      - Key: "Updated"
        Value: "2024-01-01"
    state: present

- name: Delete a VSAN from a policy
  cisco.intersight.intersight_vsan_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "datacenter-vsan-policy"
    vsans:
      - name: "vsan_uplink_100"
        vsan_id: 100
        fcoe_vlan_id: 100
        vsan_scope: "uplink"
      - name: "vsan_storage_200"
        vsan_id: 200
        fcoe_vlan_id: 200
        vsan_scope: "storage"
        state: absent
    state: present

- name: Delete a VSAN Policy
  cisco.intersight.intersight_vsan_policy:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "datacenter-vsan-policy"
    state: absent

Return Values

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

Key

Description

api_repsonse

dictionary

The API response output returned by the specified resource.

Returned: always

Sample: {"api_response": {"EnableTrunking": false, "Name": "datacenter-vsan-policy", "ObjectType": "fabric.FcNetworkPolicy", "Tags": [{"Key": "Site", "Value": "DataCenter-A"}], "vsans": [{"FcoeVlan": 100, "Name": "vsan_uplink_100", "ObjectType": "fabric.Vsan", "VsanId": 100, "VsanScope": "Uplink"}]}}

Authors

  • Ron Gershburg (@rgershbu)