cisco.intersight.intersight_port_policy_info module – Gather information about Cisco Intersight Port Policies

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_port_policy_info.

Synopsis

  • Gathers information about Port Policies and their associated resources on Cisco Intersight.

  • Retrieves comprehensive information including breakout ports, server ports, uplink port channels, pin groups, and all other port configurations.

  • Supports filtering by policy name and organization.

  • 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"

name

string

Name of the Port Policy to retrieve information for.

If not provided, information for all Port Policies will be returned.

organization

string

The name of the Organization to filter policies by.

If not provided, policies from all accessible organizations will be returned.

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: Get information about all Port Policies
  cisco.intersight.intersight_port_policy_info:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
  register: all_port_policies

- name: Get information about a specific Port Policy
  cisco.intersight.intersight_port_policy_info:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "port-policy-example"
  register: specific_policy

- name: Get information about Port Policies in a specific organization
  cisco.intersight.intersight_port_policy_info:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: "production"
  register: org_policies

- name: Get information about a specific Port Policy in a specific organization
  cisco.intersight.intersight_port_policy_info:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "port-policy-example"
    organization: "production"
  register: specific_org_policy

Return Values

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

Key

Description

api_response

list / elements=dictionary

List of Port Policy information with all associated resources

Returned: always

Sample: [{"AppliancePcRoles": [], "ApplianceRoles": [], "BreakoutPorts": [{"CustomMode": "BreakoutEthernet25G", "Moid": "5dee1d736972652d321d26b6", "ObjectType": "fabric.PortMode", "PortId": 49, "SlotId": 1}], "Description": "Example port policy with various configurations", "DeviceModel": "UCS-FI-6454", "FcPortModes": [{"CustomMode": "FibreChannel", "Moid": "5dee1d736972652d321d26b7", "ObjectType": "fabric.PortMode", "PortIdEnd": 16, "PortIdStart": 1, "SlotId": 1}], "FcStorageRoles": [], "FcUplinkPortChannels": [{"AdminSpeed": "16Gbps", "Moid": "5dee1d736972652d321d26be", "ObjectType": "fabric.FcUplinkPcRole", "PcId": 13, "Ports": [{"AggregatePortId": 0, "PortId": 17, "SlotId": 1}, {"AggregatePortId": 0, "PortId": 18, "SlotId": 1}], "SlotId": 1, "UserLabel": "FC Uplink PC 13", "VsanId": 1}], "FcUplinkRoles": [{"AdminSpeed": "16Gbps", "Moid": "5dee1d736972652d321d26bf", "ObjectType": "fabric.FcUplinkRole", "PortId": 19, "SlotId": 1, "UserLabel": "FC Uplink 19", "VsanId": 1}], "FcoeUplinkPcRoles": [], "FcoeUplinkRoles": [], "LanPinGroups": [{"Moid": "5dee1d736972652d321d26c1", "Name": "pin-group-1", "ObjectType": "fabric.LanPinGroup", "PinTargetInterfaceRole": {"Moid": "5dee1d736972652d321d26c2", "ObjectType": "fabric.UplinkPcRole"}}], "Moid": "5dee1d736972652d321d26b5", "Name": "port-policy-example", "ObjectType": "fabric.PortPolicy", "Organization": {"Moid": "5dee1d736972652d321d26b5", "Name": "default", "ObjectType": "organization.Organization"}, "SanPinGroups": [{"Moid": "5dee1d736972652d321d26c3", "Name": "san-pin-group-1", "ObjectType": "fabric.SanPinGroup", "PinTargetInterfaceRole": {"Moid": "5dee1d736972652d321d26c4", "ObjectType": "fabric.FcUplinkPcRole"}}], "ServerRoles": [{"AggregatePortId": 49, "Fec": "Auto", "Moid": "5dee1d736972652d321d26b8", "ObjectType": "fabric.ServerRole", "PortId": 1, "PreferredDeviceId": 1, "PreferredDeviceType": "Chassis", "SlotId": 1, "UserLabel": "Server Port 1"}], "Tags": [{"Key": "Environment", "Value": "Production"}], "UplinkPcRoles": [{"AdminSpeed": "25Gbps", "EthNetworkGroupPolicy": [{"Moid": "5dee1d736972652d321d26ba", "ObjectType": "fabric.EthNetworkGroupPolicy"}], "Fec": "Auto", "FlowControlPolicy": {"Moid": "5dee1d736972652d321d26bb", "ObjectType": "fabric.FlowControlPolicy"}, "LinkAggregationPolicy": {"Moid": "5dee1d736972652d321d26bc", "ObjectType": "fabric.LinkAggregationPolicy"}, "LinkControlPolicy": {"Moid": "5dee1d736972652d321d26bd", "ObjectType": "fabric.LinkControlPolicy"}, "Moid": "5dee1d736972652d321d26b9", "ObjectType": "fabric.UplinkPcRole", "PcId": 123, "Ports": [{"AggregatePortId": 0, "PortId": 1, "SlotId": 1}, {"AggregatePortId": 0, "PortId": 2, "SlotId": 1}], "SlotId": 1, "UserLabel": "Uplink PC 123"}], "UplinkRoles": [{"AdminSpeed": "25Gbps", "Fec": "Auto", "Moid": "5dee1d736972652d321d26c0", "ObjectType": "fabric.UplinkRole", "PortId": 3, "SlotId": 1, "UserLabel": "Ethernet Uplink 3"}]}]

Authors

  • Ron Gershburg (@rgershbu)