cisco.intersight.intersight_vlan_policy_info module – Gather information about VLAN Policies and their VLANs in Cisco Intersight
Note
This module is part of the cisco.intersight collection (version 2.2.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_vlan_policy_info
.
Synopsis
Retrieve comprehensive information about VLAN Policies and their associated VLANs from Cisco Intersight.
Query policies by organization, policy name, or filter VLANs by name patterns.
Returns structured data combining policy metadata with detailed VLAN configurations.
Supports filtering by organization, policy name, and VLAN name.
If no filters are provided, all VLAN Policies and their VLANs will be returned.
Returns structured data with both policy information and associated VLAN details.
Parameters
Parameter |
Comments |
---|---|
Public API Key ID associated with the private key. If not set, the value of the INTERSIGHT_API_KEY_ID environment variable is used. |
|
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. |
|
URI used to access the Intersight API. If not set, the value of the INTERSIGHT_API_URI environment variable is used. Default: |
|
The exact name of the VLAN Policy to retrieve information from. When specified, only the matching policy and its VLANs will be returned. Can be combined with vlan_name filter to get specific VLANs from a specific policy. |
|
The name of the organization to filter VLAN Policies by. Use ‘default’ for the default organization. When specified, only policies from this organization will be returned. |
|
If Choices:
|
|
Boolean control for verifying the api_uri TLS certificate Choices:
|
|
Filter VLANs by name within the policies. Can be used with or without policy name filtering. Supports exact matching (e.g., “prod_100” will match only “prod_100”). When combined with policy name, filters VLANs within that specific policy. |
Examples
# Basic Usage Examples
- name: Fetch all VLAN Policies and their VLANs from all organizations
cisco.intersight.intersight_vlan_policy_info:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
register: all_vlan_policies
# Organization-specific Examples
- name: Fetch all VLAN Policies from the default organization
cisco.intersight.intersight_vlan_policy_info:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
register: default_org_policies
- name: Fetch all VLAN Policies from a custom organization
cisco.intersight.intersight_vlan_policy_info:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "Engineering"
register: engineering_policies
# Specific Policy Examples
- name: Fetch a specific VLAN Policy by name with all its VLANs
cisco.intersight.intersight_vlan_policy_info:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
name: "datacenter-vlan-policy"
register: specific_policy
- name: Display policy details
debug:
msg: "Policy {{ specific_policy.api_response.policy.Name }} has {{ specific_policy.api_response.vlans | length }} VLANs"
# VLAN Filtering Examples
- name: Find all policies containing a specific VLAN
cisco.intersight.intersight_vlan_policy_info:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
vlan_name: "prod_100"
register: policies_with_prod_100
- name: Find specific VLAN in a specific policy
cisco.intersight.intersight_vlan_policy_info:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
name: "datacenter-vlan-policy"
vlan_name: "mgmt_300"
register: specific_vlan_in_policy
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The API response containing policy and VLAN information. Returns a dictionary when querying a single policy or no policies found. Returns a list when multiple policies are found. Returned: always Sample: |
|
VLAN policy information Returned: always |
|
List of VLANs associated with the policy Returned: always |