Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 131 additions & 12 deletions playbooks/sda_fabric_virtual_networks_playbook_config_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,138 @@
gather_facts: false
vars_files:
- "credentials.yml"
module_defaults:
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
dnac_host: "{{ dnac_host }}"
dnac_username: "{{ dnac_username }}"
dnac_password: "{{ dnac_password }}"
dnac_verify: "{{ dnac_verify }}"
dnac_port: "{{ dnac_port }}"
dnac_version: "{{ dnac_version }}"
dnac_debug: "{{ dnac_debug }}"
dnac_log: true
dnac_log_level: DEBUG
state: gathered

tasks:
# Example 1: Generate all configurations with default file path
- name: Generate playbook config for all components using default file path
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
# No config provided - generates all configurations

# Example 2: Generate all configurations with custom file path
- name: Generate the playbook config for all Fabric VLANs, Virtual Networks, and Anycast Gateways in Cisco Catalyst Center
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
dnac_host: "{{ dnac_host }}"
dnac_username: "{{ dnac_username }}"
dnac_password: "{{ dnac_password }}"
dnac_verify: "{{ dnac_verify }}"
dnac_port: "{{ dnac_port }}"
dnac_version: "{{ dnac_version }}"
dnac_debug: "{{ dnac_debug }}"
dnac_log_level: DEBUG
dnac_log: true
state: gathered
- name: Generate playbook config for all components with custom file path and overwrite mode
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/all_configurations.yml"
file_mode: "overwrite"

# Example 3: Generate all Fabric VLANs with custom file path
- name: Generate the playbook config for all Fabric VLANs in Cisco Catalyst Center
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/all_fabric_vlans.yml"
file_mode: "append"
config:
component_specific_filters:
components_list: ["fabric_vlan"]

# Example 4: Generate all Virtual Networks with custom file path
- name: Generate the playbook config for all Virtual Networks in Cisco Catalyst Center
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/all_virtual_networks.yml"
file_mode: "append"
config:
component_specific_filters:
components_list: ["virtual_networks"]

# Example 5: Generate all Anycast Gateways with custom file path
- name: Generate the playbook config for all Anycast Gateways in Cisco Catalyst Center
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/all_anycast_gateways.yml"
file_mode: "append"
config:
component_specific_filters:
components_list: ["anycast_gateways"]

# Example 6: Generate all components with custom file path
- name: Generate all components by explicitly listing all in components_list (equivalent to no config)
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/all_configurations.yml"
file_mode: "overwrite"
config:
component_specific_filters:
components_list: ["fabric_vlan", "virtual_networks", "anycast_gateways"]

# Example 7: Generate Fabric VLANs using VLAN filters
- name: Generate the playbook config for Fabric VLANs using vlan filters
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/fabric_vlans.yml"
file_mode: "append"
config:
component_specific_filters:
# No components_list specified, but fabric_vlan filters are provided
# The fabric_vlan component will be automatically added to components_list
fabric_vlan:
- vlan_name: "Test123"
vlan_id: 1031
- vlan_name: "abc"
vlan_id: 1038

# Example 8: Generate Virtual Networks using VN name filters
- name: Generate the playbook config for Virtual Networks using vn names
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/virtual_networks.yml"
file_mode: "append"
config:
component_specific_filters:
# No components_list specified, but virtual_networks filters are provided
# The virtual_networks component will be automatically added to components_list
virtual_networks:
- vn_name: "VN1"
- vn_name: "VN3"

# Example 9: Generate Anycast Gateways using VN name filter
- name: Generate the playbook config for Anycast Gateways with vn names
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/anycast_gateways_vn.yml"
config:
component_specific_filters:
# components_list is optional when component-specific filters are provided
components_list: ["anycast_gateways"]
anycast_gateways:
- vn_name: "Chennai_VN1"
- vn_name: "Chennai_VN3"

# Example 10: Generate Anycast Gateways using multiple filters
- name: Generate the playbook config for Anycast Gateways with multiple filters
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/anycast_gateways.yml"
file_mode: "append"
config:
component_specific_filters:
# components_list is optional when component-specific filters are provided
components_list: ["anycast_gateways"]
anycast_gateways:
- vlan_name: "Chennai-VN1-Pool2"
vlan_id: 1022
ip_pool_name: "Chennai-VN1-Pool2"
vn_name: "Chennai_VN1"
- vlan_name: "Chennai-VN7-Pool1"
vlan_id: 1033
ip_pool_name: "Chennai-VN7-Pool1"
vn_name: "Chennai_VN7"

# Example 11: Generate all components using multiple filters
- name: Generate the playbook config for Fabric VLANs, Virtual Networks, and Anycast Gateways with filters
cisco.dnac.sda_fabric_virtual_networks_playbook_config_generator:
file_path: "tmp/config.yml"
config:
component_specific_filters:
fabric_vlan:
- vlan_name: "Test123"
- vlan_id: 1031
virtual_networks:
- vn_name: "VN1"
- vn_name: "VN3"
anycast_gateways:
- ip_pool_name: "Chennai-VN1-Pool2"
- vn_name: "Chennai_VN1"
Loading