Skip to content
Open
Show file tree
Hide file tree
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
51 changes: 51 additions & 0 deletions playbooks/sda_host_port_migration_playbook_config_generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
- name: SDA Host Port Assignment Migration Playbook Generator Example
hosts: localhost
gather_facts: false
vars_files:
- credentials.yml
tasks:
- name: Generate host port assignment and port channel migration configuration
cisco.catalystcenter.sda_host_port_migration_playbook_config_generator:
catalystcenter_host: "{{ catalystcenter_host }}"
catalystcenter_username: "{{ catalystcenter_username }}"
catalystcenter_password: "{{ catalystcenter_password }}"
catalystcenter_verify: "{{ catalystcenter_verify }}"
catalystcenter_port: "{{ catalystcenter_port }}"
catalystcenter_version: "{{ catalystcenter_version }}"
catalystcenter_debug: "{{ catalystcenter_debug }}"
catalystcenter_log: true
catalystcenter_log_level: DEBUG
state: gathered
file_path: "host_port_migration_playbook.yml"
file_mode: "overwrite"
config:
component_specific_filters:
port_assignments:
- fabric_site_name_hierarchy: "Global/US/California/San Jose/SJC21"
source_device_ip: "12.12.12.30"
destination_device_ip: "10.0.0.2"
interface_mappings:
- source_interface_name: "GigabitEthernet3/0/24"
destination_interface_name: "TenGigabitEthernet3/0/24"
- fabric_site_name_hierarchy: "Global/US/California/San Jose/SJC24"
source_device_ip: "12.12.12.20"
destination_device_ip: "10.0.0.4"
interface_mappings:
- source_interface_name: "GigabitEthernet3/0/6"
destination_interface_name: "TenGigabitEthernet3/0/6"
port_channels:
- fabric_site_name_hierarchy: "Global/US/California/San Jose/SJC21"
source_device_ip: "12.12.12.30"
destination_device_ip: "10.0.0.2"
interface_mappings:
- source_interface_name: "GigabitEthernet2/0/3"
destination_interface_name: "TenGigabitEthernet2/0/3"
- source_interface_name: "GigabitEthernet3/0/3"
destination_interface_name: "TenGigabitEthernet3/0/3"
- fabric_site_name_hierarchy: "Global/US/California/San Jose/SJC4"
source_device_ip: "31.1.39.11"
destination_device_ip: "10.0.0.3"
interface_mappings:
- source_interface_name: "GigabitEthernet1/0/1"
destination_interface_name: "TenGigabitEthernet1/0/1"
14 changes: 14 additions & 0 deletions playbooks/switch_refresh_cleanup_old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Clean up old switch after Catalyst Center switch refresh validation
hosts: localhost
connection: local
gather_facts: false
vars_files:
- vars/switch_refresh_usecase.yml
vars:
switch_refresh_phase: cleanup_old
switch_refresh_cleanup_old: true
roles:
- role: switch_refresh
tags:
- switch_refresh_cleanup_old
14 changes: 14 additions & 0 deletions playbooks/switch_refresh_prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Prepare replacement switch for Catalyst Center switch refresh
hosts: localhost
connection: local
gather_facts: false
vars_files:
- vars/switch_refresh_usecase.yml
vars:
switch_refresh_phase: prepare
switch_refresh_cleanup_old: false
roles:
- role: switch_refresh
tags:
- switch_refresh_prepare
143 changes: 143 additions & 0 deletions playbooks/vars/switch_refresh_usecase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
# Sample Catalyst Center connection values. Replace with vault variables or
# inventory variables in production.
catalystcenter_host: "<catalyst-center-ip-or-fqdn>"
catalystcenter_port: 443
catalystcenter_username: "<username>"
catalystcenter_password: "<password>"
catalystcenter_version: "2.3.7.9"
catalystcenter_verify: false
catalystcenter_debug: false
catalystcenter_log: false
catalystcenter_log_level: INFO

switch_refresh_work_dir: /tmp/catalystcenter_switch_refresh
switch_refresh_onboarding_method: discovery
switch_refresh_device_info_lookup_enabled: true
switch_refresh_fabric_validation_enabled: true
switch_refresh_sda_host_port_onboarding_config_verify: true
switch_refresh_sda_fabric_devices_config_verify: true
switch_refresh_provision_config_verify: true

switch_refresh_devices:
- name: sjc-edge-01-refresh

# Required topology input.
fabric_site_name_hierarchy: Global/USA/SAN-JOSE/BLDG23
onboarding_method: discovery

# Minimal old-switch input: provide any one of management_ip, hostname,
# serial_number, or mac_address. The role resolves management IP with
# network_devices_info.
old:
hostname: SJ-EDGE-OLD.cisco.local

# Minimal new-switch input. The role auto-builds SINGLE discovery config
# using Catalyst Center global credentials, then auto-builds provision_config.
new:
management_ip: 10.10.10.20

# Optional discovery overrides.
# discovery_name: switch-refresh-sjc-edge-01
# protocol_order: ssh
# discovery_retry: 2
# use_global_credentials: true

# Optional. Pass full discovery_config only when you need custom discovery
# credentials or a non-SINGLE discovery type.
# discovery_config:
# single:
# - discovery_name: switch-refresh-sjc-edge-01
# discovery_type: SINGLE
# ip_address_list:
# - 10.10.10.20
# protocol_order: ssh
# retry: 2
# discovery_specific_credentials:
# cli_credentials_list:
# - username: "<switch-cli-username>"
# password: "<switch-cli-password>"
# enable_password: "<switch-enable-password>"

# Optional. Defaults to EDGE_NODE.
# device_roles:
# - EDGE_NODE

# Optional. Only use when you need a custom provision payload.
# provision_config:
# - site_name_hierarchy: Global/USA/SAN-JOSE/BLDG23
# management_ip_address: 10.10.10.20

# Optional. Only use when you need a custom fabric device payload.
# fabric_devices_config:
# - fabric_devices:
# fabric_name: Global/USA/SAN-JOSE/BLDG23
# device_config:
# - device_ip: 10.10.10.20
# device_roles:
# - EDGE_NODE

# Provide mappings only when the new switch uses different interface names
# or a different port layout. Unmapped source interfaces are migrated 1:1.
interface_mappings:
- source_interface_name: GigabitEthernet1/0/1
destination_interface_name: TenGigabitEthernet1/0/1
- source_interface_name: GigabitEthernet1/0/2
destination_interface_name: TenGigabitEthernet1/0/2
- source_interface_name: GigabitEthernet1/0/47
destination_interface_name: TenGigabitEthernet1/1/1
- source_interface_name: GigabitEthernet1/0/48
destination_interface_name: TenGigabitEthernet1/1/2

- name: sjc-edge-02-refresh-1-to-1
fabric_site_name_hierarchy: Global/USA/SAN-JOSE/BLDG23
onboarding_method: discovery
old:
serial_number: FOC1234ABCD
new:
management_ip: 10.10.10.21

# Empty mapping means the generator keeps old interface names as-is.
interface_mappings: []

# LAN Automation onboarding option.

Check warning on line 103 in playbooks/vars/switch_refresh_usecase.yml

View workflow job for this annotation

GitHub Actions / Sanity (Ⓐdevel)

103:3 [comments-indentation] comment not indented like content
# Use this instead of discovery when the replacement switch should be
# onboarded through Catalyst Center LAN Automation. Keep new.management_ip set
# to the expected management IP after LAN Automation so later steps can find
# the switch in inventory.
#
# - name: sjc-edge-03-refresh-lan-auto
# fabric_site_name_hierarchy: Global/USA/SAN-JOSE/BLDG23
# onboarding_method: lan_automation
# old:
# hostname: SJ-EDGE-OLD-03.cisco.local
# new:
# management_ip: 204.1.1.13
# lan_automation_config:
# - lan_automation:
# discovered_device_site_name_hierarchy: Global/USA/SAN JOSE
# peer_device_management_ip_address: 91.1.1.2
# primary_device_management_ip_address: 204.1.1.4
# primary_device_interface_names:
# - HundredGigE1/0/2
# ip_pools:
# - ip_pool_name: underlay_sub
# ip_pool_role: MAIN_POOL
# - ip_pool_name: underlay_sub_small
# ip_pool_role: PHYSICAL_LINK_POOL
# multicast_enabled: true
# redistribute_isis_to_bgp: true
# host_name_prefix: San-Jose
# isis_domain_pwd: cisco
# discovery_level: 5
# discovery_timeout: 40
# discovery_devices:
# - device_serial_number: FXS2429Q0WE
# device_host_name: SR-LAN-9400X-EDGE1
# device_site_name_hierarchy: Global/USA/SAN JOSE/BLD20/BLD20_FLOOR1
# device_management_ip_address: 204.1.1.13
# launch_and_wait: true
# pnp_authorization: false
# interface_mappings:
# - source_interface_name: GigabitEthernet1/0/1
# destination_interface_name: TenGigabitEthernet1/0/1
Loading
Loading