ansible-galaxy collection install -r requirements.yml
pip install catalystcentersdk>=3.1.3.0.0Create a vault file to store sensitive credentials:
ansible-vault create group_vars/all/vault.ymlAdd the following content:
vault_catalystcenter_host: "catalystcenter.example.com"
vault_catalystcenter_username: "admin"
vault_catalystcenter_password: "your_password"ansible-playbook example_playbook.yml --ask-vault-pass- Workflow-manager roles use the base name of the Catalyst Center module, such as
inventoryforinventory_workflow_manager. - Config-generator roles use the
_config_generatorsuffix, such asinventory_config_generatorforinventory_playbook_config_generator.
Each role now follows the conventional ansible-galaxy init role scaffold:
role_name/
├── files/
├── handlers/
│ └── main.yml
├── templates/
├── tasks/
│ └── main.yml
├── defaults/
│ └── main.yml
├── meta/
│ └── main.yml
├── tests/
│ ├── inventory
│ └── test.yml
├── vars/
│ └── main.yml
└── README.md
The files/ and templates/ directories are scaffolded for standard role compatibility and may remain empty for roles that do not need static assets or Jinja templates.
All roles share these connection variables:
catalystcenter_hostcatalystcenter_usernamecatalystcenter_passwordcatalystcenter_verifycatalystcenter_portcatalystcenter_versioncatalystcenter_debugcatalystcenter_log_levelcatalystcenter_log
Workflow-manager roles expose module arguments as role-prefixed variables. Common examples are:
<role_name>_state<role_name>_config_verify<role_name>_config
Config-generator roles follow the same pattern and typically expose:
<role_name>_state<role_name>_file_path<role_name>_file_mode<role_name>_config
If file_path is not set, the underlying module uses its built-in timestamped filename behavior.
- hosts: localhost
roles:
- role: site
vars:
catalystcenter_host: "{{ vault_catalystcenter_host }}"
catalystcenter_username: "{{ vault_catalystcenter_username }}"
catalystcenter_password: "{{ vault_catalystcenter_password }}"
site_state: merged
site_config:
- site_type: area
site:
area:
name: "USA"
parent_name: "Global"- hosts: localhost
roles:
- role: site_config_generator
vars:
catalystcenter_host: "{{ vault_catalystcenter_host }}"
catalystcenter_username: "{{ vault_catalystcenter_username }}"
catalystcenter_password: "{{ vault_catalystcenter_password }}"
site_config_generator_state: gathered
site_config_generator_file_path: "tmp/site_playbook_config.yml"
site_config_generator_config:
global_filters:
site:
- "Global/USA"Always store sensitive information in Ansible Vault.
Config-generator roles write YAML playbook input files locally. They do not apply any configuration by themselves.
Use <role_name>_config_verify: true for workflow roles when you want post-change validation from the underlying module.
- hosts: localhost
roles:
- role: inventory
tags: ["inventory"]
- role: inventory_config_generator
tags: ["inventory", "generator"]Workflow-manager roles rely on the idempotent behavior of the underlying cisco.catalystcenter modules. Config-generator roles are read-only and intended for playbook input generation.
Each role includes tests/test.yml and tests/inventory so maintainers have a consistent starting point for role-local validation.