cisco.catalystcenter.catalystcenter inventory -- Cisco Catalyst Center dynamic inventory plugin
Note
This inventory plugin is part of the cisco.catalystcenter collection (version 2.9.1).
To install it, use: ansible-galaxy collection install cisco.catalystcenter.
You need further requirements to be able to use this inventory plugin,
see Requirements for details.
To use it in a playbook, specify: cisco.catalystcenter.catalystcenter.
New in cisco.catalystcenter 2.10.0
Synopsis
Queries Cisco Catalyst Center for network devices and builds an Ansible inventory.
Creates groups based on site hierarchy, device role, device family, and tags.
Supports pagination for large-scale deployments (500+ devices).
Uses the catalystcentersdk Python SDK for API communication.
Requirements
The below requirements are needed on the local controller node that executes this inventory.
catalystcentersdk >= 2.3.7
Parameters
Parameter |
Comments |
|---|---|
Number of devices to retrieve per API call. Catalyst Center has a maximum of 500 records per call. Default: :ansible-option-default:`500` |
|
Catalyst Center API version string. Default: :ansible-option-default:`"3.1.6.0"` Configuration:
|
|
Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work. Choices: Configuration:
|
|
Cache connection data or path, read cache plugin documentation for specifics. Configuration:
|
|
Cache plugin to use for the inventory's source data. Default: :ansible-option-default:`"memory"` Configuration:
|
|
Prefix to use for cache plugin files/tables Default: :ansible-option-default:`"ansible\_inventory\_"` Configuration:
|
|
Cache duration in seconds Default: :ansible-option-default:`3600` Configuration:
|
|
Create vars from jinja2 expressions. Default: :ansible-option-default:`{}` |
|
Additional keyword arguments passed to the Catalyst Center Use this to pre-filter devices by family, role, management IP, etc. Keys Default: :ansible-option-default:`{}` |
|
Create Ansible groups by device family (e.g., Choices: |
|
Create Ansible groups by device role (e.g., Choices: |
|
Create Ansible groups from the Catalyst Center site hierarchy. Choices: |
|
Create Ansible groups from Catalyst Center device tags. Disabled by default because it requires additional API calls. Choices: |
|
Add hosts to group based on Jinja2 conditionals. Default: :ansible-option-default:`{}` |
|
Hostname or IP address of the Catalyst Center appliance. Configuration:
|
|
Device attribute to use as the Ansible inventory hostname. Choices: |
|
Include Unified Access Points in the inventory. Disabled by default because APs are not typically managed via CLI. Choices: |
|
Add hosts to group based on the values of a variable. Default: :ansible-option-default:`[]` |
|
Password for Catalyst Center authentication. Configuration:
|
|
Token that ensures this is a source file for the plugin. Choices: |
|
TCP port for the Catalyst Center API. Default: :ansible-option-default:`443` Configuration:
|
|
Automatically set Choices: |
|
If Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. Choices: |
|
Prefix for tag-based group names. Default: :ansible-option-default:`"tag\_"` |
|
Set Choices: |
|
Username for Catalyst Center authentication. Default: :ansible-option-default:`"admin"` Configuration:
|
|
Whether to validate SSL certificates. Choices: Configuration:
|
Examples
# Minimal configuration (use ansible-vault for the password in production)
plugin: cisco.catalystcenter.catalystcenter
host: catalyst.example.com
username: admin
password: "{{ vault_cc_password }}"
validate_certs: false
# With environment variables (CATALYSTCENTER_HOST, CATALYSTCENTER_USERNAME, etc.)
plugin: cisco.catalystcenter.catalystcenter
validate_certs: false
# Full-featured configuration
plugin: cisco.catalystcenter.catalystcenter
host: catalyst.example.com
username: admin
password: "{{ vault_cc_password }}"
validate_certs: false
api_version: "3.1.6.0"
# Grouping options
group_by_site: true
group_by_role: true
group_by_family: true
group_by_tag: true
tag_prefix: "cctag_"
# Include access points
include_aps: true
# Pre-filter devices by family
device_filters:
family: "Switches and Hubs"
# Constructable features
keyed_groups:
- key: cc_software_type
prefix: os
separator: "_"
- key: cc_series
prefix: hw
separator: "_"
compose:
ansible_host: cc_management_ip
site_role: cc_role | lower
groups:
reachable: cc_reachability_status == "Reachable"
unreachable: cc_reachability_status == "Unreachable"
# Caching (reduces API calls)
cache: true
cache_plugin: ansible.builtin.jsonfile
cache_timeout: 3600
cache_connection: /tmp/catalystcenter_inventory_cache