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.
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: |
name string | 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. |
organization string | 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. |
use_proxy boolean | If Choices:
|
validate_certs boolean | Boolean control for verifying the api_uri TLS certificate Choices:
|
vlan_name string | 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. |
# 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
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
api_response dictionary | 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 dictionary |
VLAN policy information Returned: always |
|
vlans list / elements=string |
List of VLANs associated with the policy Returned: always |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/cisco/intersight/intersight_vlan_policy_info_module.html