cisco.intersight.intersight_macsec_policy module – MACsec Policy configuration for Cisco Intersight
Note
This module is part of the cisco.intersight collection (version 2.12.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_macsec_policy.
Synopsis
Manages MACsec Policy configuration on Cisco Intersight.
A policy to configure MACsec encryption settings for fabric interconnect ports.
Supports primary keychain and optional fallback keychain configuration.
For more information see Cisco Intersight.
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: |
|
Cipher suite to be used for MACsec encryption. Choices:
|
|
The MACsec confidentiality offset specifies the number of bytes starting from the frame header. MACsec encrypts only the bytes after the offset in a frame. Choices:
|
|
Enable configuration of fallback keychain. Choices:
|
|
The user-defined description for the MACsec Policy. Description can contain letters(a-z, A-Z), numbers(0-9), hyphen(-), period(.), colon(:), or an underscore(_). |
|
Ethertype to use in EAPoL frames for MKA PDUs. The range is between 0x600 - 0xffff. Default: |
|
MAC address to use in extensible authentication protocol over LAN (EAPoL) for MKA PDUs. EAPol MAC address should not be equal to all-zero (0000.0000.0000). Default: |
|
Fallback keychain name. Required when |
|
List of security keys for the fallback keychain. Default: |
|
Cryptographic algorithm for the key. Choices:
|
|
The time of day and date when the key becomes inactive. Format should be ISO 8601 format (e.g., 2025-11-21T09:20:00.000Z or 2025-11-21T09:20:00.000). The ‘Z’ suffix will be automatically added if not provided. Required when |
|
Key ID must have an even number of hexadecimal characters (0-9, A-F). Length must be between 2 and 64 characters. |
|
Indicates that the key remains active indefinitely. When When Choices:
|
|
Indicates key lifetime behavior after start time.
Choices:
|
|
Key secret is a shared secret used in cryptographic operations. Must start with the character ‘J’. |
|
The time of day and date when the key becomes active. Format should be ISO 8601 format (e.g., 2025-11-20T09:14:00.000Z or 2025-11-20T09:14:00.000). The ‘Z’ suffix will be automatically added if not provided. Required when |
|
The time zone used for key lifetime configurations. Only used when Choices:
|
|
Configures inclusion of the optional integrity check value (ICV) indicator. Part of the transmitted MACsec key agreement protocol data unit (PDU). Choices:
|
|
Key server is selected by comparing priority values during MKA message exchange. Valid values range from 0 to 255. Lower value means higher chance of being selected as key server. Default: |
|
The name assigned to the MACsec Policy. The name must be between 1 and 62 alphanumeric characters, allowing special characters :-_. |
|
The name of the Organization this resource is assigned to. Profiles, Policies, and Pools that are created within a Custom Organization are applicable only to devices in the same Organization. Default: |
|
Primary keychain name for managing the default set of security keys. |
|
List of security keys for the primary keychain. Default: |
|
Cryptographic algorithm for the key. Choices:
|
|
The time of day and date when the key becomes inactive. Format should be ISO 8601 format (e.g., 2025-11-21T09:20:00.000Z or 2025-11-21T09:20:00.000). The ‘Z’ suffix will be automatically added if not provided. Required when |
|
Key ID must have an even number of hexadecimal characters (0-9, A-F). Length must be between 2 and 64 characters. |
|
Indicates that the key remains active indefinitely. When When Choices:
|
|
Indicates key lifetime behavior after start time.
Choices:
|
|
Key secret is a shared secret used in cryptographic operations. Must start with the character ‘J’. |
|
The time of day and date when the key becomes active. Format should be ISO 8601 format (e.g., 2025-11-20T09:14:00.000Z or 2025-11-20T09:14:00.000). The ‘Z’ suffix will be automatically added if not provided. Required when |
|
The time zone used for key lifetime configurations. Only used when Choices:
|
|
Defines the size of the replay protection window. Determines the number of packets that can be received out of order without being considered replay attacks. Valid range is from 0 to 596000000. Default: |
|
Time in seconds to force secure association key (SAK) rekey. Valid range is from 60 to 2592000 seconds. When set to 0 or not configured, SAK rekey interval is determined based on interface speed. |
|
The security policy specifies the level of MACsec enforcement on network traffic.
Choices:
|
|
If If Choices:
|
|
List of tags in Key:<user-defined key> Value:<user-defined value> format. |
|
If Choices:
|
|
Boolean control for verifying the api_uri TLS certificate Choices:
|
Examples
- name: Create MACsec Policy with Primary Keychain Only
cisco.intersight.intersight_macsec_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "macsec-policy-01"
description: "MACsec policy with primary keychain"
cipher_suite: "gcm-aes-xpn-256"
security_policy: "should-secure"
primary_keychain_name: "primary-keychain"
primary_keys:
- id: "1234"
cryptographic_algorithm: "aes-256-cmac"
secret: >-
Ja1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9bd2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c122222222222222222222222222222222222222222222
key_lifetime_always_active: true
tags:
- Key: Environment
Value: Production
state: present
- name: Create MACsec Policy with Fallback Keychain
cisco.intersight.intersight_macsec_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "macsec-policy-02"
description: "MACsec policy with fallback keychain"
cipher_suite: "gcm-aes-256"
security_policy: "must-secure"
key_server_priority: 32
sak_expiry_time: 3600
primary_keychain_name: "primary-keychain"
primary_keys:
- id: "ABCD"
cryptographic_algorithm: "aes-256-cmac"
secret: >-
Ja1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9bd2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c122222222222222222222222222222222222222222222
configure_fallback_keychain: true
fallback_keychain_name: "fallback-keychain"
fallback_keys:
- id: "EF12"
cryptographic_algorithm: "aes-128-cmac"
secret: "Jf1e2d3c4b5a6f7e8d9c0b1a2f3e4d5c6b7a8f9e0d1c2b3a4f5e6d7c8b9a0f1e2d3c4b5a6f7e8d9c0b1a2f3e4d5c6b7a8f9e0d1c2b3a4f5e6d7c8b9a0f1e2d3c4b5a6f7e8d9c0"
state: present
- name: Create MACsec Policy with Custom Settings
cisco.intersight.intersight_macsec_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "macsec-policy-custom"
description: "MACsec policy with custom settings"
cipher_suite: "gcm-aes-xpn-128"
confidentiality_offset: "conf-offset-30"
security_policy: "must-secure"
key_server_priority: 64
sak_expiry_time: 7200
replay_window_size: 200000000
include_icv_indicator: true
eapol_mac_address: "0180.C200.0004"
eapol_ethertype: "0x88e5"
primary_keychain_name: "custom-keychain"
primary_keys:
- id: "2468"
cryptographic_algorithm: "aes-256-cmac"
secret: "Jabcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz"
state: present
- name: Create MACsec Policy with Scheduled Key Lifetime (Never Expires)
cisco.intersight.intersight_macsec_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "macsec-policy-scheduled-never"
description: "MACsec policy with scheduled key that never expires"
primary_keychain_name: "scheduled-keychain"
primary_keys:
- id: "3456"
cryptographic_algorithm: "aes-256-cmac"
secret: "Jabcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz"
key_lifetime_always_active: false
timezone: "local"
start_time: "2025-11-20T10:00:00.000"
lifetime_type: "never"
state: present
- name: Create MACsec Policy with Scheduled Key Lifetime (With End Time)
cisco.intersight.intersight_macsec_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "macsec-policy-scheduled-endtime"
description: "MACsec policy with scheduled key with end time"
primary_keychain_name: "scheduled-keychain-endtime"
primary_keys:
- id: "4567"
cryptographic_algorithm: "aes-256-cmac"
secret: "Jabcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz"
key_lifetime_always_active: false
timezone: "utc"
start_time: "2025-11-20T09:20:00.000Z"
lifetime_type: "on-this-day"
end_time: "2025-11-21T09:20:00.000Z"
state: present
- name: Delete MACsec Policy
cisco.intersight.intersight_macsec_policy:
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
organization: "default"
name: "macsec-policy-01"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The API response output returned by the specified resource. Returned: always Sample: |