├── roles ├── ndfc_device_config_get │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_list_get │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_names_get │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_fabric_config_get │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_network_config_get │ ├── vars │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── README.md ├── ndfc_rest_config_deploy │ ├── vars │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_vpc_config_get │ ├── vars │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── README.md ├── ndfc_vrf_config_get │ ├── vars │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── meta │ │ └── main.yml ├── ndfc_service_node_config_get │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_service_route_peering_config_get │ ├── vars │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_service_node_merged │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_service_node_deleted │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_fabric_asn_get │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_access_mode_get │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_access_mode_set │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_active_fabrics_get │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_config_deploy_all │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_device_set_role │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_merged_all │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ └── worker.yml │ └── README.md ├── ndfc_rest_interface_no_shutdown │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_device_intent_config_get │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_interface_shutdown │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_info_get │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_merged │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_list_merged │ ├── defaults │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── ndfc_policy_vrf_rt_import_evpn_loop │ ├── tasks │ │ └── main.yml │ └── meta │ │ └── main.yml ├── ndfc_vrf_all │ ├── tasks │ │ ├── main.yml │ │ └── worker.yml │ └── meta │ │ └── main.yml ├── ndfc_device_deleted_all │ ├── tasks │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── README.md ├── ndfc_vrf_query │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_deleted │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_vrf_replaced │ ├── meta │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── ndfc_device_info_get │ ├── meta │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── ndfc_network_deleted │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_network_deleted_all │ ├── meta │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ └── worker.yml │ └── README.md ├── ndfc_network_info_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_network_replaced │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_fabric_delete │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_vpc_create │ ├── meta │ │ └── main.yml │ └── README.md ├── ndfc_rest_vpc_delete │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_device_model_number_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_serial_number_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_network_replaced_all │ ├── meta │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ └── worker.yml │ └── README.md ├── ndfc_rest_device_rediscover │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_fabric_create_msd │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_service_node_add │ ├── meta │ │ └── main.yml │ └── defaults │ │ └── main.yml ├── ndfc_rest_vrf_list_by_fabric │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_vpc_interface_merged_all │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_generated_configs_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_device_ipv4_address_local_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_policy_vrf_rt_import_evpn │ ├── meta │ │ └── main.yml │ └── README.md ├── ndfc_rest_device_list_by_fabric │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_create_external │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_msd_child_add │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_fabric_msd_child_remove │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_device_generated_configs_all_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ └── worker.yml │ └── README.md ├── ndfc_device_interface_config_all_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ ├── main.yml │ │ └── worker.yml │ └── README.md ├── ndfc_device_ipv4_address_remote_get │ ├── meta │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── README.md ├── ndfc_rest_fabric_create_easy_fabric │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_fabric_create_lan_classic │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml ├── ndfc_rest_fabric_create_easy_fabric_ebgp │ ├── meta │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml └── ndfc_service_route_peering_intra_tenant_fw_merged │ ├── meta │ └── main.yml │ ├── defaults │ └── main.yml │ └── README.md ├── requirements.yml ├── inventory ├── hosts │ └── hosts └── group_vars │ └── ndfc │ └── 00_connection.yml ├── reference_topology.pdf ├── example_ndfc_network_replaced.yml ├── ansible.cfg ├── example_ndfc_vrf_replaced.yml ├── example_ndfc_device_merged.yml ├── example_ndfc_device_deleted.yml ├── example_ndfc_device_deleted_all.yml ├── example_ndfc_device_merged_all.yml ├── example_ndfc_network_deleted.yml ├── example_ndfc_rest_fabric_delete.yml ├── example_ndfc_network_deleted_all.yml ├── example_ndfc_network_replaced_all.yml ├── example_ndfc_service_node_merged.yml ├── example_ndfc_rest_config_deploy_all.yml ├── example_ndfc_rest_fabric_create_msd.yml ├── example_ndfc_service_node_deleted.yml ├── example_ndfc_vpc_interface_merged_all.yml ├── example_ndfc_rest_fabric_create_easy_fabric.yml ├── example_ndfc_rest_fabric_create_lan_classic.yml ├── example_ndfc_rest_device_set_role.yml ├── example_ndfc_rest_fabric_create_external.yml ├── example_ndfc_device_generated_configs_all_get.yml ├── example_ndfc_rest_device_rediscover.yml ├── example_ndfc_vrf_all_deleted.yml ├── example_ndfc_vrf_all_merged.yml ├── example_ndfc_rest_vpc_create.yml ├── example_ndfc_rest_interface_shutdown.yml ├── example_ndfc_service_route_peering_intra_tenant_fw_merged.yml ├── .github ├── dependabot.yml ├── workflows │ ├── stale.yml │ ├── lint.yml │ └── scorecard.yml ├── ISSUE_TEMPLATE │ ├── FEATURE_REQUEST.md │ └── BUG_REPORT.md └── PULL_REQUEST_TEMPLATE.md ├── example_ndfc_rest_interface_no_shutdown.yml ├── example_ndfc_device_interface_config_all_get.yml ├── example_ndfc_rest_config_deploy.yml ├── example_ndfc_network_info_get.yml ├── example_ndfc_vrf_config_get.yml ├── example_ndfc_rest_vpc_delete.yml ├── example_ndfc_fabric_config_get.yml ├── example_ndfc_vpc_config_get.yml ├── .markdownlint.json ├── example_ndfc_rest_fabric_info_get.yml ├── example_ndfc_service_node_config_get.yml ├── example_ndfc_device_config_get.yml ├── example_ndfc_rest_device_intent_config_get.yml ├── example_ndfc_rest_fabric_asn_get.yml ├── example_ndfc_device_generated_configs_get.yml ├── example_ndfc_rest_fabric_active_fabrics_get.yml ├── example_ndfc_rest_service_node_add.yml ├── example_ndfc_rest_fabric_access_mode_set.yml ├── example_ndfc_device_list_merged.yml ├── example_ndfc_network_config_get.yml ├── example_ndfc_service_route_peering_config_get.yml ├── example_ndfc_device_list_get.yml ├── example_ndfc_vrf_query.yml ├── example_ndfc_device_names_get.yml ├── example_ndfc_device_model_number_get.yml ├── example_ndfc_rest_fabric_msd_child_add.yml ├── example_ndfc_device_serial_number_get.yml ├── example_ndfc_rest_fabric_access_mode_get.yml ├── example_ndfc_rest_fabric_msd_child_remove.yml ├── example_ndfc_device_ipv4_address_remote_get.yml ├── example_ndfc_device_ipv4_address_local_get.yml ├── example_ndfc_policy_vrf_rt_import_evpn.yml ├── example_ndfc_rest_fabric_delete_f1.yml ├── example_ndfc_rest_fabric_delete_f2.yml ├── example_ndfc_device_info_get.yml ├── example_ndfc_rest_vrf_list_by_fabric.yml ├── example_ndfc_policy_vrf_rt_import_evpn_loop.yml ├── example_ndfc_rest_device_list_by_fabric.yml ├── issues_2.md ├── issues_1.md ├── SECURITY.md ├── example_ndfc_rest_fabric_create_easy_fabric_f1.yml ├── example_ndfc_rest_fabric_create_easy_fabric_f2.yml └── example_ndfc_rest_fabric_delete_msd.yml /roles/ndfc_device_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_device_names_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_fabric_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_network_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: httpapi -------------------------------------------------------------------------------- /roles/ndfc_vpc_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_config_get/vars/main.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: local 2 | -------------------------------------------------------------------------------- /requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | - name: cisco.dcnm 4 | version: 2.1.0 5 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_merged/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_service_node_merged/defaults/main.yml 2 | -------------------------------------------------------------------------------- /inventory/hosts/hosts: -------------------------------------------------------------------------------- 1 | --- 2 | ndfc: 3 | hosts: 4 | ndfc1: 5 | ansible_host: 198.168.1.1 6 | -------------------------------------------------------------------------------- /reference_topology.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-open/ndfc-roles/HEAD/reference_topology.pdf -------------------------------------------------------------------------------- /roles/ndfc_service_node_deleted/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_service_node_deleted/defaults/main.yml 2 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_asn_get/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_fabric_create/defaults/main.yml 2 | greenfield_debug_flag: Enable 3 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_get/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_fabric_create/defaults/main.yml 2 | greenfield_debug_flag: Enable 3 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_set/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_fabric_create/defaults/main.yml 2 | greenfield_debug_flag: Enable 3 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_active_fabrics_get/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_fabric_create/defaults/main.yml 2 | greenfield_debug_flag: Enable 3 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_config_deploy/defaults/main.yml 2 | forceShowRun: false 3 | inclAllMSDSwitches: false 4 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy_all/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_config_deploy/defaults/main.yml 2 | forceShowRun: false 3 | inclAllMSDSwitches: false 4 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_set_role/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_devices_create/defaults/main.yml 2 | forceShowRun: false 3 | inclAllMSDSwitches: false 4 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged_all/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_devices_create/defaults/main.yml 2 | auth_proto: MD5 3 | max_hops: 0 4 | preserve_config: False 5 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_no_shutdown/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_devices_create/defaults/main.yml 2 | forceShowRun: false 3 | inclAllMSDSwitches: false 4 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_intent_config_get/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_config_deploy/defaults/main.yml 2 | forceShowRun: false 3 | inclAllMSDSwitches: false 4 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_shutdown/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_interfaces_shutdown/defaults/main.yml 2 | forceShowRun: false 3 | inclAllMSDSwitches: false 4 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_info_get/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_external_create/defaults/main.yml 2 | greenfield_debug_flag: Enable 3 | IS_READ_ONLY: false 4 | -------------------------------------------------------------------------------- /example_ndfc_network_replaced.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: ndfc 3 | gather_facts: false 4 | roles: 5 | - ndfc_network_replaced 6 | vars: 7 | network_name: f1_n1111 8 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | # DCNM/NDFC require the following timeout values under persistent_connection to be >= 1000 seconds. 2 | [persistent_connection] 3 | command_timeout=1800 4 | connect_timeout=1800 5 | -------------------------------------------------------------------------------- /example_ndfc_vrf_replaced.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vrf_replaced.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_vrf_replaced 7 | vars: 8 | vrf_name: f2_v2 9 | -------------------------------------------------------------------------------- /example_ndfc_device_merged.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_merged.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_merged 7 | vars: 8 | device_name: spine_1 9 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_devices_create/defaults/main.yml 2 | auth_proto: MD5 3 | max_hops: 0 4 | preserve_config: false 5 | forceShowRun: false 6 | inclAllMSDSwitches: false 7 | -------------------------------------------------------------------------------- /example_ndfc_device_deleted.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_deleted.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_deleted 7 | vars: 8 | device_name: spine_1 9 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_merged/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_devices_create/defaults/main.yml 2 | auth_proto: MD5 3 | max_hops: 0 4 | preserve_config: false 5 | forceShowRun: false 6 | inclAllMSDSwitches: false 7 | -------------------------------------------------------------------------------- /example_ndfc_device_deleted_all.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_deleted_all.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_deleted_all 7 | vars: 8 | fabric_name: f1 9 | -------------------------------------------------------------------------------- /example_ndfc_device_merged_all.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_merged_all.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_merged_all 7 | vars: 8 | fabric_name: f1 9 | -------------------------------------------------------------------------------- /example_ndfc_network_deleted.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_network_deleted.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_network_deleted 7 | vars: 8 | network_name: msd_n1111 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_delete.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_delete.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_fabric_delete 7 | vars: 8 | fabric_name: f1 9 | -------------------------------------------------------------------------------- /example_ndfc_network_deleted_all.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_network_deleted_all.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_network_deleted_all 7 | vars: 8 | fabric_name: MSD 9 | -------------------------------------------------------------------------------- /example_ndfc_network_replaced_all.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_network_replaced_all.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_network_replaced_all 7 | vars: 8 | fabric_name: MSD 9 | -------------------------------------------------------------------------------- /example_ndfc_service_node_merged.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_service_node_merged.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_service_node_merged 7 | vars: 8 | service_node_name: sn_1 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_config_deploy_all.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_config_deploy_all.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_config_deploy_all 7 | vars: 8 | fabric_name: f1 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_create_msd.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_create_msd.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_fabric_create_msd 7 | vars: 8 | fabric_name: MSD 9 | -------------------------------------------------------------------------------- /example_ndfc_service_node_deleted.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_service_node_deleted.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_service_node_deleted 7 | vars: 8 | service_node_name: sn_1 9 | -------------------------------------------------------------------------------- /example_ndfc_vpc_interface_merged_all.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vpc_interface_merged_all.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_vpc_interface_merged_all 7 | vars: 8 | vpc_name: vpc_1 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_create_easy_fabric.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_create_easy_fabric.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_fabric_create_easy_fabric 7 | vars: 8 | fabric_name: f1 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_create_lan_classic.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_create_lan_classic 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_fabric_create_lan_classic 7 | vars: 8 | fabric_name: LC_1 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_device_set_role.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_device_set_role.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_device_set_role 7 | vars: 8 | device_name: leaf_1 9 | role: leaf 10 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_create_external.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_create_external.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_fabric_create_external 7 | vars: 8 | fabric_name: ext_fabric_1 9 | -------------------------------------------------------------------------------- /roles/ndfc_policy_vrf_rt_import_evpn_loop/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_policy_vrf_rt_import_evpn_loop/tasks/main.yml 2 | --- 3 | - name: main {{ state }} VRF route-target import/export 4 | include_tasks: worker.yml 5 | loop: "{{ device_list }}" 6 | -------------------------------------------------------------------------------- /example_ndfc_device_generated_configs_all_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_generated_configs_all_get.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_generated_configs_all_get 7 | vars: 8 | fabric_name: f1 9 | -------------------------------------------------------------------------------- /example_ndfc_rest_device_rediscover.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_rediscover.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_device_rediscover 7 | vars: 8 | device_name: spine_1 9 | fabric_name: f1 10 | -------------------------------------------------------------------------------- /example_ndfc_vrf_all_deleted.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vrf_all_deleted.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_vrf_all 7 | - ndfc_rest_config_deploy_all 8 | vars: 9 | fabric_name: f2 10 | state: deleted 11 | -------------------------------------------------------------------------------- /example_ndfc_vrf_all_merged.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vrf_all_merged.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_vrf_all 7 | - ndfc_rest_config_deploy_all 8 | vars: 9 | fabric_name: f1 10 | state: merged 11 | -------------------------------------------------------------------------------- /example_ndfc_rest_vpc_create.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_vpc_create.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_vpc_create 7 | - ndfc_rest_config_deploy_all 8 | vars: 9 | fabric_name: f2 10 | vpc_name: vpc_3 11 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vrf/tasks/main.yml 2 | --- 3 | - name: main {{ state }} FABRIC {{ fabric_name }} 4 | include_tasks: worker.yml 5 | loop: "{{ vrfs.values() | list | json_query(mq1) }}" 6 | vars: 7 | mq1: "[?fabric == '{{ fabric_name }}']" 8 | -------------------------------------------------------------------------------- /example_ndfc_rest_interface_shutdown.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_interface_shutdown.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_interface_shutdown 7 | vars: 8 | device_name: spine_1 9 | interface_name: Ethernet1/32 10 | -------------------------------------------------------------------------------- /example_ndfc_service_route_peering_intra_tenant_fw_merged.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_service_node_merged.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_service_route_peering_intra_tenant_fw_merged 7 | vars: 8 | service_route_peering_name: srp_1 9 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | groups: 6 | github: 7 | patterns: 8 | - "actions/*" 9 | - "github/*" 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /example_ndfc_rest_interface_no_shutdown.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_interface_no_shutdown.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_interface_no_shutdown 7 | vars: 8 | device_name: spine_1 9 | interface_name: Ethernet1/32 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_deleted_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_deleted_all/tasks/main.yml 2 | - name: main deleted FABRIC {{ fabric_name }} all devices 3 | cisco.dcnm.dcnm_inventory: 4 | fabric: "{{ fabric_name }}" 5 | state: deleted 6 | vars: 7 | ansible_connection: httpapi 8 | -------------------------------------------------------------------------------- /roles/ndfc_vpc_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # vpc_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact vpc_config {{ vpc_name }} 4 | ansible.builtin.set_fact: 5 | vpc_config: "{{ vpc_peers | json_query(vpc_config_get_q1) }}" 6 | vars: 7 | vpc_config_get_q1: "{{ vpc_name }}" 8 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vrf_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact vrf_config {{ vrf_name }} 4 | ansible.builtin.set_fact: 5 | vrf_config: "{{ vrfs | json_query(vrf_config_get_q1) }}" 6 | vars: 7 | vrf_config_get_q1: "{{ vrf_name }}" 8 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_query/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /example_ndfc_device_interface_config_all_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_interface_config_all_get.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_interface_config_all_get 7 | vars: 8 | fabric_name: f1 9 | interface_name: Ethernet1/11 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_deleted/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # roles/ndfc_network_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact network_config {{ network_name }} 4 | ansible.builtin.set_fact: 5 | network_config: "{{ networks | json_query(mq1) }}" 6 | vars: 7 | mq1: "{{ network_name }}" 8 | -------------------------------------------------------------------------------- /roles/ndfc_vpc_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_replaced/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_deleted_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_info_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_merged/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_names_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_fabric_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_info_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_asn_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_delete/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vpc_create/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vpc_delete/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_merged/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /example_ndfc_rest_config_deploy.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_config_deploy.yml 2 | # Calls config-save on the device's fabric, and config_deploy on device_name 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_rest_config_deploy 8 | vars: 9 | device_name: leaf_1 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_model_number_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_serial_number_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_rediscover/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_set_role/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_msd/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_info_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_shutdown/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_service_node_add/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vrf_list_by_fabric/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_deleted/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_vpc_interface_merged_all/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_ipv4_address_local_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_policy_vrf_rt_import_evpn/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_intent_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_list_by_fabric/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_set/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_external/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_msd_child_add/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_msd_child_remove/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_no_shutdown/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact device_config {{ device_name }} 4 | ansible.builtin.set_fact: 5 | device_config: "{{ devices | json_query(device_config_get_q1) }}" 6 | vars: 7 | device_config_get_q1: "{{ device_name }}" 8 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_all_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_interface_config_all_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_device_ipv4_address_remote_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_policy_vrf_rt_import_evpn_loop/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_active_fabrics_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_easy_fabric/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_lan_classic/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_config_get/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /roles/ndfc_vpc_interface_merged_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vpc_interface_merged_all/tasks/main.yml 2 | - name: main merged VPC {{ vpc_name }} vpc_interface 3 | include_tasks: worker.yml 4 | loop: "{{ vpc_interfaces.values() | list | json_query(mq1) }}" 5 | vars: 6 | mq1: "[?vpc_name == '{{ vpc_name }}']" 7 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_easy_fabric_ebgp/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /example_ndfc_network_info_get.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: ndfc 3 | gather_facts: false 4 | roles: 5 | - ndfc_network_info_get 6 | vars: 7 | network_name: msd_n1111 8 | tasks: 9 | - block: 10 | - debug: 11 | var: network_info | default('unable to find network. Check network_name.', true) 12 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_intra_tenant_fw_merged/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Allen Robel 3 | description: Principal Engineer 4 | company: Cisco Systems, Inc. 5 | license: license (GPL-2.0-or-later, MIT, etc) 6 | min_ansible_version: 2.1 7 | galaxy_tags: 8 | - ndfc 9 | - cisco 10 | -------------------------------------------------------------------------------- /example_ndfc_vrf_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vrf_config_get.yml 2 | # Query local vars for vrf configuration 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_vrf_config_get 8 | vars: 9 | vrf_name: msd_v1 10 | tasks: 11 | - block: 12 | - debug: 13 | var: vrf_config 14 | -------------------------------------------------------------------------------- /example_ndfc_rest_vpc_delete.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_vpc_delete.yml 2 | # This does not work currently. We're investigating it. 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_rest_vpc_delete 8 | - ndfc_rest_config_deploy_all 9 | vars: 10 | fabric_name: f1 11 | vpc_name: vpc_1 12 | -------------------------------------------------------------------------------- /roles/ndfc_device_ipv4_address_local_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_ipv4_address_local_get/tasks/main.yml 2 | 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | # Device ipv4 address 7 | - name: set_fact device_ipv4_address 8 | set_fact: 9 | device_ipv4_address: "{{ device_config.ip }}" 10 | -------------------------------------------------------------------------------- /example_ndfc_fabric_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_fabric_config_get.yml 2 | # Query local vars for fabric configuration 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_fabric_config_get 8 | vars: 9 | fabric_name: f1 10 | tasks: 11 | - block: 12 | - debug: 13 | var: fabric_config 14 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_merged_all/tasks/main.yml 2 | --- 3 | - name: merged FABRIC {{ fabric_name }} all devices 4 | include_tasks: worker.yml 5 | loop: "{{ lookup('ansible.builtin.dict', devices) }}" 6 | when: "fabric_name in device.value.switch_fabric" 7 | loop_control: 8 | loop_var: device 9 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_all_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_generated_configs_all_get/main.yml 2 | --- 3 | - name: main query generated configs 4 | include_tasks: worker.yml 5 | loop: "{{ lookup('ansible.builtin.dict', devices) }}" 6 | when: "fabric_name in device.value.switch_fabric" 7 | loop_control: 8 | loop_var: device 9 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_network_replaced_all/tasks/main.yml 2 | --- 3 | - name: main replaced Network FABRIC {{ fabric_name }} 4 | include_tasks: worker.yml 5 | loop: "{{ lookup('ansible.builtin.dict', networks) }}" 6 | when: "fabric_name in network.value.fabric" 7 | loop_control: 8 | loop_var: network 9 | -------------------------------------------------------------------------------- /roles/ndfc_device_interface_config_all_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_interface_config_all_get/tasks/main.yml 2 | --- 3 | - name: main query generated config 4 | include_tasks: worker.yml 5 | loop: "{{ lookup('ansible.builtin.dict', devices) }}" 6 | when: "fabric_name in device.value.switch_fabric" 7 | loop_control: 8 | loop_var: device 9 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_service_node_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact service_node_config {{ service_node_name }} 4 | ansible.builtin.set_fact: 5 | service_node_config: "{{ service_nodes | json_query(service_node_config_q1) }}" 6 | vars: 7 | service_node_config_q1: "{{ service_node_name }}" 8 | -------------------------------------------------------------------------------- /example_ndfc_vpc_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_config_get.yml 2 | # Query local vars for device configuration 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_vpc_config_get 8 | vars: 9 | vpc_name: vpc_1 10 | tasks: 11 | - block: 12 | - name: debug vpc_config 13 | debug: 14 | var: vpc_config 15 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "MD013": { 4 | "line_length": 10000, 5 | "headings": false, 6 | "code_blocks": false, 7 | "tables": false 8 | }, 9 | "MD024": { 10 | "siblings_only": true 11 | }, 12 | "MD025": { 13 | "front_matter_title": "" 14 | }, 15 | "MD041": false 16 | } 17 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_info_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_info_get.yml 2 | # Query NDFC controller for fabric_info 3 | 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_rest_fabric_info_get 8 | vars: 9 | fabric_name: MSD 10 | tasks: 11 | - block: 12 | - name: debug fabric_info 13 | debug: 14 | var: fabric_info 15 | -------------------------------------------------------------------------------- /example_ndfc_service_node_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_service_node_config_get.yml 2 | --- 3 | 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_service_node_config_get 8 | vars: 9 | service_node_name: sn_1 10 | tasks: 11 | - block: 12 | - name: debug service_node_config 13 | debug: 14 | var: service_node_config 15 | -------------------------------------------------------------------------------- /example_ndfc_device_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_config_get.yml 2 | # Query local vars for device configuration 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_device_config_get 8 | vars: 9 | device_name: leaf_1 10 | tasks: 11 | - block: 12 | - name: debug device_config 13 | debug: 14 | var: device_config 15 | -------------------------------------------------------------------------------- /example_ndfc_rest_device_intent_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_device_intent_config_get.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_device_intent_config_get 7 | vars: 8 | device_name: leaf_1 9 | tasks: 10 | - block: 11 | - name: debug device_intent_config 12 | debug: 13 | var: device_intent_config 14 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_asn_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_asn_get.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_rest_fabric_asn_get 7 | vars: 8 | fabric_name: f1 9 | tasks: 10 | - block: 11 | - debug: 12 | msg: "fabric_name {{ fabric_name }} fabric_asn: {{ fabric_asn }}" 13 | when: "fabric_asn is not none" 14 | -------------------------------------------------------------------------------- /roles/ndfc_rest_service_node_add/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_service_node_add/defaults/main.yml 2 | link_template_name: "service_link_trunk" 3 | vpc_switches_attached: false 4 | interface_speed: "Auto" 5 | interface_mtu: "jumbo" 6 | interface_allowed_vlans: "all" 7 | interface_bpduguard_enabled: true 8 | interface_porttype_fast_enabled: true 9 | interface_admin_state: true 10 | -------------------------------------------------------------------------------- /example_ndfc_device_generated_configs_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_generated_configs_get.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_generated_configs_get 7 | vars: 8 | device_name: leaf_1 9 | tasks: 10 | - block: 11 | - debug: 12 | var: device_generated_configs 13 | when: "device_generated_configs != ''" 14 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_list_get/tasks/main.yml 2 | --- 3 | - name: set fact device_list 4 | ansible.builtin.set_fact: 5 | device_list: "{{ devices | dict2items | json_query(q2) }}" 6 | vars: 7 | q2: "[?value.switch_fabric=='{{ fabric_name }}'].{seed_ip: value.ip, role: value.role, password: `{{ device_password}}`, user_name: `{{ device_username }}` }" 8 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_active_fabrics_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_active_fabrics_get.yml 2 | # Query NDFC for the list of active fabrics and print the list 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_rest_fabric_active_fabrics_get 8 | tasks: 9 | - block: 10 | - debug: 11 | var: active_fabrics 12 | when: "active_fabrics != ''" 13 | -------------------------------------------------------------------------------- /example_ndfc_rest_service_node_add.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_service_node_add.yml 2 | # Adds a service node. 3 | # NOTE: The external fabric to which the service node belongs must already exist. 4 | # See-also: example_ndfc_rest_fabric_create_external.yml 5 | --- 6 | - hosts: ndfc 7 | gather_facts: false 8 | roles: 9 | - ndfc_rest_service_node_add 10 | vars: 11 | service_node_name: sn_1 12 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_access_mode_set.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_access_mode_set.yml 2 | # fabric_name: the name of the fabric whose read_only mode will be set 3 | # read_only: the fabric access_mode. Either true or false 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_rest_fabric_access_mode_set 9 | vars: 10 | fabric_name: f1 11 | read_only: true 12 | -------------------------------------------------------------------------------- /example_ndfc_device_list_merged.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_list_merged.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_device_list_get 7 | vars: 8 | fabric_name: f1 9 | - hosts: ndfc 10 | gather_facts: false 11 | roles: 12 | - ndfc_device_list_merged 13 | vars: 14 | fabric_name: f1 15 | devices: "{{ device_list }}" 16 | -------------------------------------------------------------------------------- /example_ndfc_network_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_network_config_get.yml 2 | # Print configuration of network from vars defined in 3 | # inventory/group_vars/ndfc/03_networks.yml 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_network_config_get 9 | vars: 10 | network_name: f1_n1111 11 | tasks: 12 | - block: 13 | - debug: 14 | var: network_config 15 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_intra_tenant_fw_merged/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_service_node_add/defaults/main.yml 2 | link_template_name: "service_link_trunk" 3 | vpc_switches_attached: false 4 | interface_speed: "Auto" 5 | interface_mtu: "jumbo" 6 | interface_allowed_vlans: "all" 7 | interface_bpduguard_enabled: true 8 | interface_porttype_fast_enabled: true 9 | interface_admin_state: true 10 | -------------------------------------------------------------------------------- /example_ndfc_service_route_peering_config_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_service_route_peering_config_get.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_service_route_peering_config_get 7 | vars: 8 | service_route_peering_name: srp_1 9 | tasks: 10 | - block: 11 | - name: debug service_route_peering_config 12 | debug: 13 | var: service_route_peering_config 14 | -------------------------------------------------------------------------------- /example_ndfc_device_list_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_list_get.yml 2 | # Query NX-OS switch associated with fabric_name and device_name 3 | # and print the switch's serial number 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_device_list_get 9 | vars: 10 | fabric_name: f1 11 | tasks: 12 | - block: 13 | - debug: 14 | var: device_list 15 | when: "device_list != ''" 16 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_service_route_peering_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact service_route_peering_config {{ service_route_peering_name }} 4 | ansible.builtin.set_fact: 5 | service_route_peering_config: "{{ service_route_peerings | json_query(service_route_peering_config_q1) }}" 6 | vars: 7 | service_route_peering_config_q1: "{{ service_route_peering_name }}" 8 | -------------------------------------------------------------------------------- /roles/ndfc_fabric_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # roles/ndfc_fabric_config_get/tasks/main.yml 2 | --- 3 | - name: set_fact all_fabrics 4 | ansible.builtin.set_fact: 5 | all_fabrics: "{{ msd | combine(easy_fabric, external, lan_classic) }}" 6 | 7 | - name: set_fact fabric_config {{ fabric_name }} 8 | ansible.builtin.set_fact: 9 | fabric_config: "{{ all_fabrics | json_query(mq1) }}" 10 | vars: 11 | mq1: "{{ fabric_name }}" 12 | -------------------------------------------------------------------------------- /example_ndfc_vrf_query.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vrf_query.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_vrf_query 7 | vars: 8 | vrf_name: msd_v1 9 | tasks: 10 | - debug: 11 | msg: "vrf_info.parent.fabric: {{ vrf_info.parent.fabric }}" 12 | - debug: 13 | msg: "vrf_info.parent.vrfId: {{ vrf_info.parent.vrfId }}" 14 | - debug: 15 | msg: "vrf_info.parent.vrfStatus: {{ vrf_info.parent.vrfStatus }}" 16 | -------------------------------------------------------------------------------- /example_ndfc_device_names_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_serial_number_get.yml 2 | # Query NX-OS switch associated with fabric_name and device_name 3 | # and print the switch's serial number 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_device_names_get 9 | vars: 10 | fabric_name: f1 11 | role: leaf 12 | tasks: 13 | - block: 14 | - debug: 15 | msg: "device_names: {{ device_names }}" 16 | when: "device_names != ''" 17 | -------------------------------------------------------------------------------- /example_ndfc_device_model_number_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_model_number_get.yml 2 | # Query NX-OS switch associated with fabric_name and device_name 3 | # and print the switch's model number 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_device_model_number_get 9 | vars: 10 | device_name: leaf_1 11 | tasks: 12 | - block: 13 | - debug: 14 | msg: "device_model_number: {{ device_model_number }}" 15 | when: "device_model_number != ''" 16 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_msd_child_add.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_msd_child_add.yml 2 | # Adds child_fabric (f1 and f2) as a children of msd_fabric (MSD) 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_rest_fabric_msd_child_add 8 | vars: 9 | msd_fabric: MSD 10 | child_fabric: f1 11 | 12 | - hosts: ndfc 13 | gather_facts: false 14 | roles: 15 | - ndfc_rest_fabric_msd_child_add 16 | vars: 17 | msd_fabric: MSD 18 | child_fabric: f2 19 | -------------------------------------------------------------------------------- /example_ndfc_device_serial_number_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_serial_number_get.yml 2 | # Query NX-OS switch associated with fabric_name and device_name 3 | # and print the switch's serial number 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_device_serial_number_get 9 | vars: 10 | device_name: leaf_5 11 | tasks: 12 | - block: 13 | - debug: 14 | msg: "device_serial_number: {{ device_serial_number }}" 15 | when: "device_serial_number != ''" 16 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_access_mode_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_access_mode_get.yml 2 | # NOTE: 3 | # ndfc_rest_fabric_access_mode_get is not intended for use 4 | # within playbooks (rather, it is used within other roles). 5 | # 6 | --- 7 | - hosts: ndfc 8 | gather_facts: false 9 | roles: 10 | - ndfc_rest_fabric_access_mode_get 11 | vars: 12 | fabric_name: f1 13 | tasks: 14 | - block: 15 | - debug: 16 | msg: "fabric {{ fabric_name }} read_only: {{ read_only }}" 17 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_msd_child_remove.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_msd_child_remove.yml 2 | # Removes child_fabric (f1 and f2) as a children of msd_fabric (MSD) 3 | --- 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_rest_fabric_msd_child_remove 8 | vars: 9 | msd_fabric: MSD 10 | child_fabric: f1 11 | 12 | - hosts: ndfc 13 | gather_facts: false 14 | roles: 15 | - ndfc_rest_fabric_msd_child_remove 16 | vars: 17 | msd_fabric: MSD 18 | child_fabric: f2 19 | -------------------------------------------------------------------------------- /roles/ndfc_device_names_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_names_get/tasks/main.yml 2 | # Return a list of device names in var device_names which match the input parameters 3 | --- 4 | - name: debug role 5 | ansible.builtin.debug: 6 | var: role 7 | - name: set fact device_names 8 | ansible.builtin.set_fact: 9 | device_names: "{{ devices | dict2items | json_query(q2) }}" 10 | vars: 11 | q2: "[?value.switch_fabric=='{{ fabric_name }}' && value.role=='{{ role }}'].value.name" 12 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_delete/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_delete/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main REST DELETE FABRIC {{ fabric_name }} from ACTIVE_FABRICS {{ active_fabrics }} 7 | cisco.dcnm.dcnm_rest: 8 | method: DELETE 9 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}" 10 | when: "fabric_name in active_fabrics" 11 | vars: 12 | ansible_connection: httpapi 13 | -------------------------------------------------------------------------------- /example_ndfc_device_ipv4_address_remote_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_ipv4_address_remote_get.yml 2 | # Query NX-OS switch associated with fabric_name and device_name 3 | # and print the switch's ipv4 address based on remote device's configuration 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_device_ipv4_address_remote_get 9 | vars: 10 | device_name: leaf_1 11 | tasks: 12 | - block: 13 | - debug: 14 | msg: "device_ipv4_address: {{ device_ipv4_address }}" 15 | when: "device_ipv4_address != ''" 16 | -------------------------------------------------------------------------------- /example_ndfc_device_ipv4_address_local_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_ipv4_address_local_get.yml 2 | # Query device entry in inventory/group_vars/ndfc/01_devices.yml 3 | # containing fabric_name and device_name, and print the device's 4 | # ipv4 address. 5 | --- 6 | - hosts: ndfc 7 | gather_facts: false 8 | roles: 9 | - ndfc_device_ipv4_address_local_get 10 | vars: 11 | device_name: leaf_1 12 | tasks: 13 | - block: 14 | - debug: 15 | msg: "device_ipv4_address: {{ device_ipv4_address }}" 16 | when: "device_ipv4_address != ''" 17 | -------------------------------------------------------------------------------- /example_ndfc_policy_vrf_rt_import_evpn.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_policy_vrf_rt_import_evpn.yml 2 | # Import vrf v2's route-targets into vrf v1 on device leaf_2 in fabric f1, using Ansible state 'merged' 3 | --- 4 | - hosts: ndfc 5 | name: import vrf {{ import_vrf_name }} evpn route-targets into vrf {{ vrf_name }} on device {{ device_name }} in fabric {{ fabric_name }}, using Ansible state {{ state }} 6 | gather_facts: false 7 | roles: 8 | - ndfc_policy_vrf_rt_import_evpn 9 | vars: 10 | device_name: leaf_1 11 | vrf_name: v1 12 | import_vrf_name: v2 13 | state: merged 14 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_active_fabrics_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_active_fabrics_get 2 | # Returns list of currently-active fabrics in var 'active_fabrics' 3 | --- 4 | - name: main REST GET fabrics 5 | cisco.dcnm.dcnm_rest: 6 | method: GET 7 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 8 | register: mr1 9 | vars: 10 | ansible_connection: httpapi 11 | 12 | - name: main set_fact active_fabrics 13 | set_fact: 14 | active_fabrics: "{{ mr1.response.DATA | json_query(mq1) | to_json }}" 15 | vars: 16 | mq1: "[*].{FabricName: fabricName}" 17 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_query/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vrf_query/tasks/worker.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_vrf_config_get 5 | 6 | - name: worker query FABRIC {{ vrf_config.fabric }} VRF {{ vrf_config.vrf_name }} 7 | cisco.dcnm.dcnm_vrf: 8 | fabric: "{{ vrf_config.fabric }}" 9 | state: query 10 | config: 11 | - vrf_name: "{{ vrf_config.vrf_name }}" 12 | register: mr1 13 | vars: 14 | ansible_connection: httpapi 15 | 16 | # playbooks can cull information from the vrf_info object 17 | - name: set_fact info 18 | set_fact: 19 | vrf_info: "{{ mr1.response[0] }}" 20 | 21 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_merged/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_list_merged/tasks/main.yml 2 | 3 | # - ansible.builtin.include_role: 4 | # name: ndfc_device_config_get 5 | 6 | # - name: debug fabric_name 7 | # ansible.builtin.debug: 8 | # msg: "fabric_name {{ fabric_name }}" 9 | 10 | # - name: debug device_list 11 | # ansible.builtin.debug: 12 | # msg: "device_list {{ device_list }}" 13 | 14 | - name: merged FABRIC {{ fabric_name }} 15 | cisco.dcnm.dcnm_inventory: 16 | fabric: "{{ fabric_name }}" 17 | state: merged 18 | config: "{{ device_list }}" 19 | vars: 20 | ansible_connection: httpapi 21 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_delete_f1.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_delete_f1.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_network_deleted_all 7 | vars: 8 | fabric_name: f1 9 | 10 | - hosts: ndfc 11 | gather_facts: false 12 | roles: 13 | - ndfc_vrf_all 14 | vars: 15 | fabric_name: f1 16 | state: deleted 17 | 18 | - hosts: ndfc 19 | gather_facts: false 20 | roles: 21 | - ndfc_device_deleted_all 22 | vars: 23 | fabric_name: f1 24 | 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_rest_fabric_delete 29 | vars: 30 | fabric_name: f1 31 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_delete_f2.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_delete_f2.yml 2 | --- 3 | - hosts: ndfc 4 | gather_facts: false 5 | roles: 6 | - ndfc_network_deleted_all 7 | vars: 8 | fabric_name: f2 9 | 10 | - hosts: ndfc 11 | gather_facts: false 12 | roles: 13 | - ndfc_vrf_all 14 | vars: 15 | fabric_name: f2 16 | state: deleted 17 | 18 | - hosts: ndfc 19 | gather_facts: false 20 | roles: 21 | - ndfc_device_deleted_all 22 | vars: 23 | fabric_name: f2 24 | 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_rest_fabric_delete 29 | vars: 30 | fabric_name: f2 31 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: stale 2 | 3 | on: 4 | schedule: 5 | # Run weekly on Saturdays 6 | - cron: "30 1 * * 6" 7 | # Run the workflow manually 8 | workflow_dispatch: 9 | 10 | # Declare default permissions as read-only 11 | permissions: read-all 12 | 13 | jobs: 14 | mark-stale: 15 | # Call reusable workflow file 16 | uses: cisco-ospo/.github/.github/workflows/_stale.yml@main 17 | permissions: 18 | contents: read 19 | issues: write 20 | pull-requests: write 21 | with: 22 | days-until-stale: 60 23 | days-until-close: 7 24 | stale-label: "stale" 25 | exempt-label: "keep" 26 | -------------------------------------------------------------------------------- /roles/ndfc_device_info_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_info_get/tasks/main.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_device_config_get 4 | 5 | - name: query FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} 6 | cisco.dcnm.dcnm_inventory: 7 | fabric: "{{ device_config.switch_fabric }}" 8 | state: query 9 | config: 10 | - seed_ip: "{{ device_config.ip }}" 11 | register: wr1 12 | vars: 13 | ansible_connection: httpapi 14 | 15 | - name: set_fact device_info 16 | set_fact: 17 | device_info: "{{ wr1.response | json_query(wq1) }}" 18 | vars: 19 | wq1: "[0]" 20 | -------------------------------------------------------------------------------- /inventory/group_vars/ndfc/00_connection.yml: -------------------------------------------------------------------------------- 1 | ansible_connection: ansible.netcommon.httpapi 2 | ansible_network_os: cisco.dcnm.dcnm 3 | ansible_httpapi_validate_certs: no 4 | ansible_httpapi_use_ssl: yes 5 | # Default NDFC Controller username. 6 | # Update ansible_user if you login as a different user 7 | ansible_user: admin 8 | # ansible_password : NDFC password. See README.md in top-level directory for usage 9 | ansible_password: YourNdfcControllerPasswordGoesHere 10 | # Username for the NX-OS switches 11 | device_username: admin 12 | # Password for the NX_OS switches. See README.md in top-level directory for usage 13 | device_password: YourNxosSwitchesPasswordGoestHere 14 | 15 | -------------------------------------------------------------------------------- /roles/ndfc_device_model_number_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_model_number_get/tasks/main.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_device_config_get 4 | 5 | - name: device_model_number_get FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} 6 | cisco.dcnm.dcnm_inventory: 7 | fabric: "{{ device_config.switch_fabric }}" 8 | state: query 9 | config: 10 | - seed_ip: "{{ device_config.ip }}" 11 | register: wr1 12 | 13 | # Device model number 14 | - name: set_fact device_model_number 15 | set_fact: 16 | device_model_number: "{{ wr1.response | json_query(wq2) }}" 17 | vars: 18 | wq2: "[0].model" 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest a feature for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Problem Statement 11 | 12 | Please describe the problem to be addressed by the proposed feature. 13 | 14 | ## Proposed Solution 15 | 16 | Please describe what you envision the solution to this problem would look like. 17 | 18 | ## Alternatives Considered 19 | 20 | Please briefly describe which alternatives, if any, have been considered, including merits of alternate approaches and 21 | tradeoffs being made. 22 | 23 | ## Additional Context 24 | 25 | Please provide any other information that may be relevant. 26 | -------------------------------------------------------------------------------- /roles/ndfc_device_ipv4_address_remote_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_ipv4_address_remote_get/tasks/main.yml 2 | 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - name: device_ipv4_address_get FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} 7 | cisco.dcnm.dcnm_inventory: 8 | fabric: "{{ device_config.switch_fabric }}" 9 | state: query 10 | config: 11 | - seed_ip: "{{ device_config.ip }}" 12 | register: wr1 13 | 14 | # Device ipv4 address 15 | - name: set_fact device_ipv4_address 16 | set_fact: 17 | device_ipv4_address: "{{ wr1.response | json_query(wq2) }}" 18 | vars: 19 | wq2: "[0].ipAddress" 20 | -------------------------------------------------------------------------------- /roles/ndfc_network_info_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # roles/ndfc_network_info_get/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_network_config_get 5 | 6 | - name: query network_name {{ network_config.name }} FABRIC {{ network_config.fabric }} NETWORK {{ network_config.net_name }} 7 | cisco.dcnm.dcnm_network: 8 | fabric: "{{ network_config.fabric }}" 9 | state: query 10 | config: 11 | - net_name: "{{ network_config.net_name }}" 12 | register: wr1 13 | vars: 14 | ansible_connection: httpapi 15 | 16 | - name: set_fact network_info 17 | set_fact: 18 | network_info: "{{ wr1.response | json_query(wq1) | default('', true) }}" 19 | vars: 20 | wq1: "[0].parent" 21 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_all/tasks/worker.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vrf_all/tasks/worker.yml 2 | 3 | - name: worker {{ state }} FABRIC {{ item.fabric }} VRF {{ item.vrf_name }} VLAN {{ item.vlan_id }} 4 | cisco.dcnm.dcnm_vrf: 5 | fabric: "{{ item.fabric }}" 6 | state: "{{ state }}" 7 | config: 8 | - vrf_name: "{{ item.vrf_name }}" 9 | vrf_id: "{{ item.vrf_id }}" 10 | vlan_id: "{{ item.vlan_id }}" 11 | import_vpn_rt: "{{ item.import_vpn_rt }}" 12 | import_evpn_rt: "{{ item.import_evpn_rt }}" 13 | vrf_template: Default_VRF_Universal 14 | vrf_extension_template: Default_VRF_Extension_Universal 15 | service_vrf_template: null 16 | attach: "{{ item.attach }}" 17 | vars: 18 | ansible_connection: httpapi 19 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_network_deleted_all/tasks/main.yml 2 | --- 3 | - name: main REST GET fabrics 4 | cisco.dcnm.dcnm_rest: 5 | method: GET 6 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 7 | register: mr1 8 | vars: 9 | ansible_connection: httpapi 10 | 11 | - name: main set_fact active_fabrics 12 | set_fact: 13 | active_fabrics: "{{ mr1.response.DATA | json_query(mq1) | to_json }}" 14 | vars: 15 | mq1: "[*].{FabricName: fabricName}" 16 | 17 | - name: main deleted networks 18 | include_tasks: worker.yml 19 | loop: "{{ lookup('ansible.builtin.dict', networks) }}" 20 | when: "fabric_name in network.value.fabric" 21 | loop_control: 22 | loop_var: network 23 | 24 | -------------------------------------------------------------------------------- /example_ndfc_device_info_get.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_info_get.yml 2 | # Query NX-OS switch associated with fabric_name + device_name 3 | # Returns device_info JSON object (see ndfc_device_info_get/README.md for object format) 4 | --- 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_device_info_get 9 | vars: 10 | device_name: leaf_1 11 | tasks: 12 | - block: 13 | - debug: 14 | msg: "logicalName: {{ device_info.logicalName }}" 15 | - debug: 16 | msg: "uptime: {{ device_info.upTimeStr }}" 17 | - debug: 18 | msg: "serial: {{ device_info.serialNumber }}" 19 | - debug: 20 | msg: "version: {{ device_info.release }}" 21 | - debug: 22 | msg: "switchDbId: {{ device_info.switchDbID }}" 23 | -------------------------------------------------------------------------------- /roles/ndfc_device_serial_number_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_serial_number_get/tasks/main.yml 2 | 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - name: device_serial_number_get FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} 7 | cisco.dcnm.dcnm_inventory: 8 | fabric: "{{ device_config.switch_fabric }}" 9 | state: query 10 | config: 11 | - seed_ip: "{{ device_config.ip }}" 12 | register: r1 13 | vars: 14 | ansible_connection: httpapi 15 | 16 | # Device serial number 17 | - name: set_fact device_serial_number 18 | ansible.builtin.set_fact: 19 | device_serial_number: "{{ r1.response | json_query(q1) }}" 20 | vars: 21 | q1: "[0].serialNumber" 22 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: lint 2 | 3 | on: 4 | push: 5 | branches: 6 | # Run on pushes to default branch 7 | - main 8 | # Run against pull requests 9 | pull_request: 10 | 11 | jobs: 12 | markdown: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: 🔒 harden runner 16 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 17 | with: 18 | egress-policy: audit 19 | - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 20 | - name: ⬇️ lint markdown files 21 | uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0 22 | with: 23 | config: ".markdownlint.json" 24 | args: "**/*.md .github/**/*.md" 25 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vrf_list_by_fabric/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_vrf_list_by_fabric/tasks/main.yml 2 | # 3 | # Return JSON object 'vrf_list' which will be a list of vrf dictionaries 4 | # if the GET request is successful, or an empty list if the GET request fails 5 | --- 6 | - name: main REST GET vrfs FABRIC {{ fabric_name }} 7 | cisco.dcnm.dcnm_rest: 8 | method: GET 9 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{{ fabric_name }}/vrfs" 10 | register: mr1 11 | ignore_errors: true 12 | - name: set_fact vrf_list on success 13 | set_fact: 14 | vrf_list: "{{ mr1.response.DATA }}" 15 | when: 16 | mr1 is succeeded 17 | - name: set_fact vrf_list on failed 18 | set_fact: 19 | vrf_list: "{{ [] | to_json }}" 20 | when: 21 | mr1 is failed 22 | -------------------------------------------------------------------------------- /.github/workflows/scorecard.yml: -------------------------------------------------------------------------------- 1 | name: scorecard 2 | 3 | on: 4 | push: 5 | branches: 6 | # Run on pushes to default branch 7 | - main 8 | schedule: 9 | # Run weekly on Saturdays 10 | - cron: "30 1 * * 6" 11 | # Run when branch protection rules change 12 | branch_protection_rule: 13 | # Run the workflow manually 14 | workflow_dispatch: 15 | 16 | # Declare default permissions as read-only 17 | permissions: read-all 18 | 19 | jobs: 20 | run-scorecard: 21 | # Call reusable workflow file 22 | uses: cisco-ospo/.github/.github/workflows/_scorecard.yml@main 23 | permissions: 24 | id-token: write 25 | security-events: write 26 | secrets: inherit 27 | with: 28 | # Publish results of Scorecard analysis 29 | publish-results: true 30 | -------------------------------------------------------------------------------- /example_ndfc_rest_vrf_list_by_fabric.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_vrf_list_by_fabric_rest.yml 2 | # 3 | # Query fabric fabric_name for list of vrf dictionaries and print 4 | # specific items from each vrf dictionary. 5 | # 6 | # The Role ndfc_rest_vrf_list_by_fabric returns JSON object 'info' 7 | # which contains a list of vrf dictionaries 8 | --- 9 | - hosts: ndfc 10 | gather_facts: false 11 | roles: 12 | - ndfc_rest_vrf_list_by_fabric 13 | vars: 14 | fabric_name: f1 15 | tasks: 16 | - debug: 17 | msg: "vrfName: {{ item.vrfName }} vrfId {{ item.vrfId }} vrfStatus {{ item.vrfStatus }}" 18 | loop: "{{ info | json_query(q1) }}" 19 | vars: 20 | q1: "[*].{ vrfId: vrfId, vrfName: vrfName, vrfStatus: vrfStatus }" 21 | loop_control: 22 | label: vrf_info 23 | 24 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_intent_config_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_intent_config_get/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - ansible.builtin.include_role: 7 | name: ndfc_device_info_get 8 | 9 | - name: main REST GET intent_config DEVICE {{ device_config.name }} SERIAL {{ device_info.serialNumber }} 10 | cisco.dcnm.dcnm_rest: 11 | method: GET 12 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/policies/switches/{{ device_info.serialNumber }}/intent-config" 13 | json_data: "{{ vars_dict | to_json }}" 14 | vars: 15 | ansible_connection: httpapi 16 | vars_dict: 17 | register: mr1 18 | 19 | - name: set_fact device_intent_config 20 | set_fact: 21 | device_intent_config: "{{ mr1.response.DATA.config }}" 22 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_generated_configs_get/main.yml 2 | 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - name: query FABRIC {{ device_config.switch_fabric }} DEVICE {{ device_config.name }} IP {{ device_config.ip }} generated_config 7 | cisco.dcnm.dcnm_policy: 8 | fabric: "{{ device_config.switch_fabric }}" 9 | state: query 10 | config: 11 | - switch: 12 | - ip: "{{ device_config.ip }}" 13 | register: wr1 14 | 15 | - name: set_fact generated_config DEVICE {{ device_config.name }} IP {{ device_config.ip }} 16 | set_fact: 17 | device_generated_configs: "{{ wr1.response | json_query(wq1) }}" 18 | vars: 19 | wq1: "[?generatedConfig != ''].{TemplateName: templateName GeneratedConfig: generatedConfig}" 20 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_info_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_info_get/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main REST POST FABRIC {{ fabric_name }} active_fabrics {{ active_fabrics }} 7 | cisco.dcnm.dcnm_rest: 8 | method: GET 9 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{fabric_name}}" 10 | when: "fabric_name in active_fabrics" 11 | register: mr1 12 | vars: 13 | ansible_connection: httpapi 14 | 15 | - name: set_fact fabric_info 16 | ansible.builtin.set_fact: 17 | fabric_info: "{{ mr1 }}" 18 | when: "fabric_name in active_fabrics" 19 | 20 | - name: set_fact fabric_info null 21 | ansible.builtin.set_fact: 22 | fabric_info: "" 23 | when: "fabric_name not in active_fabrics" 24 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted_all/tasks/worker.yml: -------------------------------------------------------------------------------- 1 | # ndfc_network_deleted_all/tasks/worker.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_network_config_get 4 | vars: 5 | network_name: "{{ network.value.name }}" 6 | 7 | - ansible.builtin.include_role: 8 | name: ndfc_fabric_config_get 9 | vars: 10 | fabric_name: "{{ network.value.fabric }}" 11 | 12 | - name: worker deleted FABRIC {{ network.value.fabric }} NETWORK {{ network.value.net_name }} VRF {{ network.value.vrf_name }} VLAN {{ network.value.vlan_id }} SUBNET {{ network.value.gw_ip_subnet }} 13 | cisco.dcnm.dcnm_network: 14 | fabric: "{{ network.value.fabric }}" 15 | state: deleted 16 | config: 17 | - net_name: "{{ network.value.net_name }}" 18 | when: "network.value.fabric in active_fabrics" 19 | vars: 20 | ansible_connection: httpapi 21 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_set/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_access_mode_set 2 | # Sets fabric access mode var 'read_only' to true or false 3 | # if fabric exists, read_only will be set 4 | # if fabric does not exist, the role is skipped and no action is taken 5 | --- 6 | - ansible.builtin.include_role: 7 | name: ndfc_rest_fabric_active_fabrics_get 8 | 9 | - name: set fabric access_mode fabric {{ fabric_name }} active_fabrics {{ active_fabrics }} read_only {{ read_only }} 10 | cisco.dcnm.dcnm_rest: 11 | method: PUT 12 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}/fabricfreezeMode" 13 | json_data: "{{ payload | to_json }}" 14 | vars: 15 | ansible_connection: httpapi 16 | payload: 17 | readOnly: "{{ read_only }}" 18 | when: fabric_name in active_fabrics 19 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_list_by_fabric/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_list_by_fabric/tasks/main.yml 2 | # 3 | # Return JSON object 'switch_list' which will be a list of switch dictionaries 4 | # if the GET request is successful, or an empty list if the GET request fails 5 | --- 6 | - name: main REST GET FABRIC {{ fabric_name }} switchesByFabric 7 | cisco.dcnm.dcnm_rest: 8 | method: GET 9 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}/inventory/switchesByFabric" 10 | register: mr1 11 | ignore_errors: true 12 | - name: main set_fact switch_list SUCCESS 13 | set_fact: 14 | switch_list: "{{ mr1.response.DATA }}" 15 | when: 16 | mr1 is succeeded 17 | - name: main set_fact switch_list FAILED 18 | set_fact: 19 | switch_list: "{{ [] | to_json }}" 20 | when: 21 | mr1 is failed 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report a bug to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | 12 | Please provide a description of the problem. 13 | 14 | ## Expected Behavior 15 | 16 | Please describe what you expected would happen. 17 | 18 | ## Actual Behavior 19 | 20 | Please describe what happened instead. 21 | 22 | ## Affected Version 23 | 24 | Please provide the version number where this issue was encountered. 25 | 26 | ## Steps to Reproduce 27 | 28 | 1. First step 29 | 1. Second step 30 | 1. etc. 31 | 32 | ## Checklist 33 | 34 | 35 | - [ ] I have read the [contributing guidelines](/CONTRIBUTING.md) 36 | - [ ] I have verified this does not duplicate an existing issue 37 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged_all/tasks/worker.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_merged_all/tasks/worker.yml 2 | 3 | - name: worker merged FABRIC {{ device.value.switch_fabric }} NAME {{ device.value.name }} IP {{ device.value.ip }} MAX_HOPS {{ max_hops }} AUTH_PROTO {{ auth_proto }} 4 | cisco.dcnm.dcnm_inventory: 5 | fabric: "{{ device.value.switch_fabric }}" 6 | state: merged 7 | config: 8 | - seed_ip: "{{ device.value.ip }}" 9 | auth_proto: "{{ auth_proto }}" 10 | user_name: "{{ device_username }}" 11 | password: "{{ device_password }}" 12 | max_hops: "{{ max_hops }}" 13 | role: "{{ device.value.role }}" 14 | preserve_config: "{{ preserve_config }}" 15 | vars: 16 | ansible_connection: httpapi 17 | 18 | - ansible.builtin.include_role: 19 | name: ndfc_rest_config_deploy 20 | vars: 21 | device_name: "{{ device.value.name }}" 22 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy_all/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_config_deploy_all/tasks/main.yml 2 | --- 3 | - name: main REST POST config-save FABRIC {{ fabric_name }} 4 | cisco.dcnm.dcnm_rest: 5 | method: POST 6 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}/config-save" 7 | json_data: "{{ vars_dict | to_json }}" 8 | vars: 9 | ansible_connection: httpapi 10 | vars_dict: 11 | 12 | - name: main REST POST config-deploy FABRIC {{ fabric_name }} 13 | cisco.dcnm.dcnm_rest: 14 | method: POST 15 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}/config-deploy" 16 | json_data: "{{ vars_dict | to_json }}" 17 | vars: 18 | ansible_connection: httpapi 19 | vars_dict: 20 | forceShowRun: "{{ forceShowRun }}" 21 | inclAllMSDSwitches: "{{ inclAllMSDSwitches }}" -------------------------------------------------------------------------------- /roles/ndfc_vrf_replaced/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vrf_replaced/tasks/main.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_vrf_config_get 4 | 5 | - name: replaced FABRIC {{ vrf_config.fabric }} VRF {{ vrf_config.vrf_name }} VRF_ID {{ vrf_config.vrf_id }} VLAN {{ vrf_config.vlan_id }} 6 | cisco.dcnm.dcnm_vrf: 7 | fabric: "{{ vrf_config.fabric }}" 8 | state: replaced 9 | config: 10 | - vrf_name: "{{ vrf_config.vrf_name }}" 11 | vrf_id: "{{ vrf_config.vrf_id }}" 12 | vlan_id: "{{ vrf_config.vlan_id }}" 13 | import_vpn_rt: "{{ item.import_vpn_rt }}" 14 | import_evpn_rt: "{{ item.import_evpn_rt }}" 15 | vrf_template: Default_VRF_Universal 16 | vrf_extension_template: Default_VRF_Extension_Universal 17 | service_vrf_template: null 18 | attach: "{{ vrf_config.attach }}" 19 | vars: 20 | ansible_connection: httpapi 21 | -------------------------------------------------------------------------------- /roles/ndfc_device_interface_config_all_get/tasks/worker.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_interface_config_all_get/tasks/worker.yml 2 | 3 | - name: worker query FABRIC {{ fabric_name }} ROLE {{ device.value.role}} DEVICE {{ device.value.name }} INTERFACE {{ interface_name }}" 4 | cisco.dcnm.dcnm_policy: 5 | fabric: "{{ fabric_name }}" 6 | state: query 7 | config: 8 | - switch: 9 | - ip: "{{ device.value.ip }}" 10 | register: wr1 11 | vars: 12 | ansible_connection: httpapi 13 | 14 | - name: worker set_fact interface_config 15 | set_fact: 16 | interface_config: "{{ wr1.response | json_query(wq1) }}" 17 | vars: 18 | wq1: "[?contains(generatedConfig, '{{ interface_name }}') == `true`].{TemplateName: templateName GeneratedConfig: generatedConfig}" 19 | 20 | - name: worker show interface policy INTERFACE {{ interface_name }} 21 | debug: 22 | var: interface_config 23 | -------------------------------------------------------------------------------- /roles/ndfc_device_deleted/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - ansible.builtin.include_role: 3 | name: ndfc_device_config_get 4 | 5 | - ansible.builtin.include_role: 6 | name: ndfc_device_serial_number_get 7 | vars: 8 | device_name: "{{ device_config.name }}" 9 | fabric_name: "{{ device_config.switch_fabric }}" 10 | 11 | - name: device deleted fabric {{ device_config.switch_fabric }} name {{ device_config.name }} ip {{ device_config.ip }} serial_number ({{ device_serial_number }}) 12 | cisco.dcnm.dcnm_inventory: 13 | fabric: "{{ device_config.switch_fabric }}" 14 | state: deleted 15 | config: 16 | - seed_ip: "{{ device_config.ip }}" 17 | when: "device_serial_number != ''" 18 | vars: 19 | ansible_connection: httpapi 20 | 21 | - ansible.builtin.include_role: 22 | name: ndfc_rest_config_deploy_all 23 | vars: 24 | fabric_name: "{{ device_config.switch_fabric }}" 25 | -------------------------------------------------------------------------------- /example_ndfc_policy_vrf_rt_import_evpn_loop.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_policy_vrf_rt_import_evpn_loop.yml 2 | # Import vrf v2's route-targets into vrf v1 on all leafs in fabric f1, using Ansible state 'merged' 3 | --- 4 | - hosts: ndfc 5 | name: Get device names 6 | roles: 7 | - ndfc_device_names_get 8 | vars: 9 | fabric_name: f1 10 | role: leaf 11 | 12 | - hosts: ndfc 13 | name: debug device_names 14 | gather_facts: false 15 | tasks: 16 | - ansible.builtin.debug: 17 | var: device_names 18 | - hosts: ndfc 19 | name: import vrf {{ import_vrf_name }} evpn route-targets into vrf {{ vrf_name }} on fabric f1 leafs 20 | gather_facts: false 21 | roles: 22 | - ndfc_policy_vrf_rt_import_evpn_loop 23 | vars: 24 | vrf_name: v1 25 | import_vrf_name: v2 26 | state: merged 27 | device_list: "{{ device_names }}" 28 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_active_fabrics_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_active_fabrics_get 2 | 3 | Returns the list of active fabrics on the Nexus Dashboard Fabric Controller. 4 | 5 | ## Returned Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------------|---------------------------------------- 9 | active_fabrics | list of dict | a list of active fabrics 10 | 11 | ## Example Playbook 12 | 13 | ```yaml 14 | --- 15 | - hosts: ndfc 16 | gather_facts: false 17 | roles: 18 | - ndfc_rest_fabric_active_fabrics_get 19 | tasks: 20 | - block: 21 | - debug: 22 | var: active_fabrics 23 | when: "active_fabrics != ''" 24 | ``` 25 | 26 | ## Licensing 27 | 28 | GNU General Public License v3.0 or later. 29 | 30 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 31 | 32 | ## Author Information 33 | 34 | Allen Robel (@packetcalc) 35 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_external/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_external/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main set_fact nv_pairs {{ fabric_name }} 7 | set_fact: 8 | nv_pairs: "{{ external.values() | list | json_query(mq1) }}" 9 | vars: 10 | mq1: "[?FABRIC_NAME == '{{ fabric_name }}'] | [0]" 11 | 12 | - name: main REST POST external_fabric {{ fabric_name }} active_fabrics {{ active_fabrics }} 13 | cisco.dcnm.dcnm_rest: 14 | method: POST 15 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 16 | json_data: "{{ vars_dict | to_json }}" 17 | when: "fabric_name not in active_fabrics" 18 | vars: 19 | ansible_connection: httpapi 20 | vars_dict: 21 | fabricName: "{{ fabric_name }}" 22 | templateName: External_Fabric 23 | nvPairs: "{{ nv_pairs }}" 24 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_set/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_access_mode_set 2 | 3 | Given ``fabric_name`` set the fabric access_mode to true or false via var ``read_only`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|---------|---------------------------------------- 9 | fabric_name | string | The fabric to be queried 10 | read_only | boolean | The fabric access mode (true or false) 11 | 12 | Fabric parameters are defined in the following file: 13 | 14 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Licensing 21 | 22 | GNU General Public License v3.0 or later. 23 | 24 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 25 | 26 | ## Author Information 27 | 28 | Allen Robel (@packetcalc) 29 | -------------------------------------------------------------------------------- /example_ndfc_rest_device_list_by_fabric.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_device_list_by_fabric_rest.yml 2 | # 3 | # Query fabric fabric_name for list of switch dictionaries and print 4 | # specific items from each switch dictionary. 5 | # 6 | # The Role ndfc_rest_device_list_by_fabric returns JSON object 'info' 7 | # which contains a list of switch dictionaries 8 | --- 9 | - hosts: ndfc 10 | gather_facts: false 11 | roles: 12 | - ndfc_rest_device_list_by_fabric 13 | vars: 14 | fabric_name: f2 15 | tasks: 16 | - debug: 17 | msg: "ipAddress: {{ item.ipAddress }} logicalName: {{ item.logicalName }} model {{ item.model }} release {{ item.release }} serialNumber {{ item.serialNumber }}" 18 | loop: "{{ switch_list | json_query(q1) }}" 19 | vars: 20 | q1: "[*].{ ipAddress: ipAddress, model: model, release: release, logicalName: logicalName serialNumber: serialNumber }" 21 | loop_control: 22 | label: device_info 23 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_all_get/tasks/worker.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_generated_configs_all_get/worker.yml 2 | - name: worker query WANT FABRIC {{ fabric_name }} CURRENT FABRIC {{ device.value.switch_fabric }} DEVICE {{ device.value.name }} IP {{ device.value.ip }} generated_config 3 | cisco.dcnm.dcnm_policy: 4 | fabric: "{{ device.value.switch_fabric }}" 5 | state: query 6 | config: 7 | - switch: 8 | - ip: "{{ device.value.ip }}" 9 | register: wr1 10 | vars: 11 | ansible_connection: httpapi 12 | 13 | - name: worker set_fact generated_configs DEVICE {{ device.value.name }} IP {{ device.value.ip }} 14 | set_fact: 15 | generated_configs: "{{ wr1.response | json_query(wq1) }}" 16 | vars: 17 | wq1: "[?generatedConfig != ''].{TemplateName: templateName GeneratedConfig: generatedConfig}" 18 | 19 | - name: show populated generated_configs {{ device.value.role }} {{ device.value.name }} {{ device.value.ip }} 20 | debug: 21 | var: generated_configs 22 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_delete/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_delete 2 | 3 | Delete fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric to be deleted 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_delete 27 | vars: 28 | fabric_name: f1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vpc_delete/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_vpc_delete 2 | 3 | Delete vpc peering ``vpc_name`` in fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | vpc_name | string | The name of the vpc peering to delete 10 | 11 | VPC parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/05_vpc.yml](/inventory/group_vars/ndfc/05_vpc.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | This currently does not work. We're investigating it and will update the repo once a resolution is found. 22 | 23 | ```yaml 24 | ``` 25 | 26 | ## Licensing 27 | 28 | GNU General Public License v3.0 or later. 29 | 30 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 31 | 32 | ## Author Information 33 | 34 | Allen Robel (@packetcalc) 35 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_asn_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_asn_get 2 | # Returns the current fabric asn in var 'fabric_asn' 3 | # if fabric exists, fabric_asn will contain the fabric's BGP ASN 4 | # if fabric does not exist, fabric_asn will be null 5 | --- 6 | - ansible.builtin.include_role: 7 | name: ndfc_rest_fabric_active_fabrics_get 8 | 9 | - name: get fabric info fabric {{ fabric_name }} 10 | cisco.dcnm.dcnm_rest: 11 | method: GET 12 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}" 13 | register: mr1 14 | when: fabric_name in active_fabrics 15 | vars: 16 | ansible_connection: httpapi 17 | 18 | - name: "main set_fact fabric_asn {{ mr1.response.DATA.asn }} if fabric exists" 19 | set_fact: 20 | fabric_asn: "{{ mr1.response.DATA.asn }}" 21 | when: fabric_name in active_fabrics 22 | 23 | - name: main set_fact fabric_asn null if fabric does not exist) 24 | set_fact: 25 | fabric_asn: null 26 | when: fabric_name not in active_fabrics 27 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_easy_fabric/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_easy_fabric 2 | 3 | Create fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric to be created 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_create_easy_fabric 27 | vars: 28 | fabric_name: f1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_lan_classic/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_lan_classic 2 | 3 | Create LAN_Classic fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric to be created 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_create_lan_classic 27 | vars: 28 | fabric_name: LC_1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_deleted/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_service_node_deleted 2 | 3 | Delete service node ``service_node_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ------------------|--------|---------------------------------------- 9 | service_node_name | string | The service node to merge 10 | 11 | Service node parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/06_service_nodes.yml](/inventory/group_vars/ndfc/06_service_nodes.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_service_node_deleted 27 | vars: 28 | service_node_name: sn_1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_vpc_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_vpc_config_get 2 | 3 | Retrieve configuration for ``vpc_name`` from the local inventory 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | vpc_name | string | The vpc for which local configuration information is retrieved 10 | 11 | VPC parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/05_vpc.yml](/inventory/group_vars/ndfc/05_vpc.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_vpc_config_get 27 | vars: 28 | vpc_name: vpc1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_external/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_external 2 | 3 | Create External_Fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The External fabric to be created 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_create_external 27 | vars: 28 | fabric_name: ext_fabric_1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /issues_2.md: -------------------------------------------------------------------------------- 1 | When upgrading from NDFC 12.1.1e to NDFC 12.1.2e, you may experience a key error, as follows, when adding a child fabric to an MSD fabric using the role ``ndfc_rest_fabric_msd_child_add``. 2 | 3 | ```bash 4 | Traceback (most recent call last): 5 | File "", line 1962, in addFabricAsMemberEntryCheck 6 | KeyError: 'ENABLE_PVLAN' 7 | ``` 8 | 9 | This occurs when older versions of this repo are used. 10 | 11 | ### Explanation 12 | 13 | A new key was introduced in NDFC 12.1.2e: ``ENABLE_PVLAN`` 14 | 15 | Older versions of this repo did not set this key (since it didn't exist in NDFC 12.1.1e) when creating fabrics with the following roles: 16 | 17 | - ``ndfc_rest_fabric_msd_create`` 18 | - ``ndfc_rest_fabric_switch_create`` 19 | 20 | A DDTS was filed and Closed, which provides more detail. 21 | 22 | [CSCwe26995 - addFabricAsMemberEntryCheck: KeyError: 'ENABLE_PVLAN'](https://bst.cisco.com/quickview/bug/CSCwe26995) 23 | 24 | The current version of this repo includes ``ENABLE_PVLAN`` key when creating fabrics, so will not encounter this error. 25 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_easy_fabric_ebgp/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_easy_fabric_ebgp 2 | 3 | Create Easy_Fabric_eBGP fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric to be created 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_create_easy_fabric_ebgp 27 | vars: 28 | fabric_name: EBGP_1 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_msd/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_msd 2 | 3 | Create Multi-Site Domain (MSD) fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The MSD fabric to be created 10 | 11 | Fabric parameters, including ``fabric_name`, are defined in the following file: 12 | 13 | - ./inventory/group_vars/ndfc/01_fabrics.yml 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](https://github.com/allenrobel/ndfc-roles/tree/master/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_create_msd 27 | vars: 28 | fabric_name: MSD 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_vpc_interface_merged_all/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_vpc_interface_merged_all 2 | 3 | Merge all vpc interfaces for vpc peer ``vpc_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | vpc_name | string | The name of the vpc peer for which interfaces will be merged 10 | 11 | VPC parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/05_vpc.yml](/inventory/group_vars/ndfc/05_vpc.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_vpc_interface_merged_all 27 | vars: 28 | fabric_name: f1 29 | vpc_name: vpc1 30 | ``` 31 | 32 | ## Licensing 33 | 34 | GNU General Public License v3.0 or later. 35 | 36 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 37 | 38 | ## Author Information 39 | 40 | Allen Robel (@packetcalc) 41 | -------------------------------------------------------------------------------- /roles/ndfc_device_deleted/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_deleted 2 | 3 | Delete device ``device_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | device_name | string | The device to be deleted 10 | 11 | Fabric and device parameters are defined in the following files: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Example Playbook 21 | 22 | ```yaml 23 | --- 24 | - hosts: ndfc 25 | gather_facts: false 26 | roles: 27 | - ndfc_device_deleted 28 | vars: 29 | device_name: spine_1 30 | ``` 31 | 32 | ## Licensing 33 | 34 | GNU General Public License v3.0 or later. 35 | 36 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 37 | 38 | ## Author Information 39 | 40 | Allen Robel (@packetcalc) 41 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_device_merged/tasks/main.yml 2 | 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - name: debug device_config.preserve_config 7 | ansible.builtin.debug: 8 | msg: "device_config.preserve_config {{ device_config.preserve_config }}" 9 | 10 | - name: merged FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} {{ device_config.preserve_config }} 11 | cisco.dcnm.dcnm_inventory: 12 | fabric: "{{ device_config.switch_fabric }}" 13 | state: merged 14 | config: 15 | - seed_ip: "{{ device_config.ip }}" 16 | auth_proto: "{{ auth_proto }}" 17 | user_name: "{{ device_username }}" 18 | password: "{{ device_password }}" 19 | max_hops: "{{ max_hops }}" 20 | role: "{{ device_config.role }}" 21 | preserve_config: "{{ device_config.preserve_config }}" 22 | vars: 23 | ansible_connection: httpapi 24 | 25 | - ansible.builtin.include_role: 26 | name: ndfc_rest_config_deploy 27 | vars: 28 | device_name: "{{ device_config.name }}" 29 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_set_role/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_set_role/tasks/worker.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_device_config_get 4 | 5 | - ansible.builtin.include_role: 6 | name: ndfc_device_serial_number_get 7 | vars: 8 | device_name: "{{ device_config.name }}" 9 | fabric_name: "{{ device_config.switch_fabric }}" 10 | 11 | - name: worker REST POST set device role FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} SERIAL {{ device_serial_number }} payload {{ payload }} 12 | cisco.dcnm.dcnm_rest: 13 | method: POST 14 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/switches/roles" 15 | json_data: "{{ payload | to_json }}" 16 | when: "device_serial_number != ''" 17 | vars: 18 | ansible_connection: httpapi 19 | payload: 20 | - serialNumber: "{{ device_serial_number }}" 21 | role: "{{ role }}" 22 | 23 | - ansible.builtin.include_role: 24 | name: ndfc_rest_config_deploy 25 | vars: 26 | device_name: "{{ device_config.name }}" 27 | when: "device_serial_number != ''" 28 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_get/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_access_mode_get 2 | # Returns the current fabric access mode in var 'read_only' 3 | # if fabric exists, read_only will be either true (read only mode) or false (read/write mode) 4 | # if fabric does not exist, read_only will be null 5 | --- 6 | - ansible.builtin.include_role: 7 | name: ndfc_rest_fabric_active_fabrics_get 8 | 9 | - name: get fabric access_mode fabric {{ fabric_name }} active_fabrics {{ active_fabrics }} 10 | cisco.dcnm.dcnm_rest: 11 | method: GET 12 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_name }}/accessmode" 13 | register: mr2 14 | when: fabric_name in active_fabrics 15 | vars: 16 | ansible_connection: httpapi 17 | 18 | - name: "main set_fact read_only {{ mr2.response.DATA.readonly }} if fabric exists" 19 | set_fact: 20 | read_only: "{{ mr2.response.DATA.readonly }}" 21 | when: fabric_name in active_fabrics 22 | 23 | - name: main set_fact read_only null if fabric does not exist) 24 | set_fact: 25 | read_only: null 26 | when: fabric_name not in active_fabrics 27 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_config_deploy/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - ansible.builtin.include_role: 7 | name: ndfc_device_info_get 8 | 9 | - name: main REST POST config-save FABRIC {{ device_config.switch_fabric }} 10 | cisco.dcnm.dcnm_rest: 11 | method: POST 12 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ device_config.switch_fabric }}/config-save" 13 | json_data: "{{ vars_dict | to_json }}" 14 | vars: 15 | ansible_connection: httpapi 16 | vars_dict: 17 | 18 | - name: main REST POST config-deploy FABRIC {{ device_config.switch_fabric }} device_name {{ device_name }} switchDbId {{ device_info.switchDbID }} 19 | cisco.dcnm.dcnm_rest: 20 | method: POST 21 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ device_config.switch_fabric }}/config-deploy/{{ device_info.switchDbID }}" 22 | json_data: "{{ vars_dict | to_json }}" 23 | vars: 24 | ansible_connection: httpapi 25 | vars_dict: 26 | forceShowRun: "{{ forceShowRun }}" 27 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_network_replaced 2 | 3 | Replace network ``network_name`` with its current local definition in [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | network_name | string | The network to be replaced 10 | 11 | Network parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_network_replaced 27 | vars: 28 | network_name: f1_n1111 29 | ``` 30 | 31 | ## Licensing 32 | 33 | GNU General Public License v3.0 or later. 34 | 35 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 36 | 37 | ## Author Information 38 | 39 | Allen Robel (@packetcalc) 40 | -------------------------------------------------------------------------------- /roles/ndfc_device_deleted_all/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_deleted_all 2 | 3 | Delete all devices from fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric from which the devices will be deleted 10 | 11 | Fabric and device parameters are defined in the following files: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Example Playbook 21 | 22 | ```yaml 23 | --- 24 | - hosts: ndfc 25 | gather_facts: false 26 | roles: 27 | - ndfc_device_deleted_all 28 | vars: 29 | fabric_name: f1 30 | ``` 31 | 32 | ## Licensing 33 | 34 | GNU General Public License v3.0 or later. 35 | 36 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 37 | 38 | ## Author Information 39 | 40 | Allen Robel (@packetcalc) 41 | -------------------------------------------------------------------------------- /roles/ndfc_network_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_network_config_get 2 | 3 | Retrieve local configuration for ``network_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | network_name | string | The network to be retrieved 10 | 11 | Network parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_network_config_get 27 | vars: 28 | network_name: f1_n1111 29 | tasks: 30 | - block: 31 | - name: debug network_config 32 | debug: 33 | var: network_config 34 | ``` 35 | 36 | ## Licensing 37 | 38 | GNU General Public License v3.0 or later. 39 | 40 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 41 | 42 | ## Author Information 43 | 44 | Allen Robel (@packetcalc) 45 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | Please provide a meaningful description of what this change will do, or is for. Bonus points for including links to 4 | related issues, other PRs, or technical references. 5 | 6 | Note that by _not_ including a description, you are asking reviewers to do extra work to understand the context of this 7 | change, which may lead to your PR taking much longer to review, or result in it not being reviewed at all. 8 | 9 | ## Type of Change 10 | 11 | - [ ] Bug Fix 12 | - [ ] New Feature 13 | - [ ] Breaking Change 14 | - [ ] Refactor 15 | - [ ] Documentation 16 | - [ ] Other (please describe) 17 | 18 | ## Checklist 19 | 20 | 21 | - [ ] I have read the [contributing guidelines](/CONTRIBUTING.md) 22 | - [ ] Existing issues have been referenced (where applicable) 23 | - [ ] I have verified this change is not present in other open pull requests 24 | - [ ] Functionality is documented 25 | - [ ] All code style checks pass 26 | - [ ] New code contribution is covered by automated tests 27 | - [ ] All new and existing tests pass 28 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_msd/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_msd_create/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main set_fact nv_pairs {{ fabric_name }} 7 | set_fact: 8 | nv_pairs: "{{ msd.values() | list | json_query(mq1) }}" 9 | vars: 10 | mq1: "[?FABRIC_NAME == '{{ fabric_name }}'] | [0]" 11 | 12 | - name: main REST POST msd_fabric {{ fabric_name }} active_fabrics {{ active_fabrics }} 13 | cisco.dcnm.dcnm_rest: 14 | method: POST 15 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 16 | json_data: "{{ vars_dict | to_json }}" 17 | when: "fabric_name not in active_fabrics" 18 | vars: 19 | ansible_connection: httpapi 20 | vars_dict: 21 | fabricName: "{{ fabric_name }}" 22 | fabricType: MFD 23 | fabricTypeFriendly: "Multi-Fabric Domain" 24 | fabricTechnology: VXLANFabric 25 | fabricTechnologyFriendly: "VXLAN Fabric" 26 | provisionMode: DCNMTopDown 27 | deviceType: n9k 28 | templateName: MSD_Fabric 29 | nvPairs: "{{ nv_pairs }}" 30 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_lan_classic/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_lan_classis/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main set_fact nv_pairs {{ fabric_name }} 7 | set_fact: 8 | nv_pairs: "{{ lan_classic.values() | list | json_query(mq1) }}" 9 | vars: 10 | mq1: "[?FABRIC_NAME == '{{ fabric_name }}'] | [0]" 11 | 12 | - name: main REST POST lan_classic {{ fabric_name }} active_fabrics {{ active_fabrics }} 13 | cisco.dcnm.dcnm_rest: 14 | method: POST 15 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 16 | json_data: "{{ vars_dict | to_json }}" 17 | when: "fabric_name not in active_fabrics" 18 | vars: 19 | ansible_connection: httpapi 20 | vars_dict: 21 | fabricName: "{{ fabric_name }}" 22 | fabricType: External 23 | fabricTypeFriendly: External 24 | templateName: LAN_Classic 25 | fabricTechnology: LANClassic 26 | fabricTechnologyFriendly": "LAN Classic" 27 | nvPairs: "{{ nv_pairs }}" 28 | -------------------------------------------------------------------------------- /roles/ndfc_device_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_config_get 2 | 3 | Retrieve local configuration for ``device_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | device_name | string | The device for which local configuration information is retrieved 10 | 11 | Device parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_device_config_get 27 | vars: 28 | device_name: leaf_1 29 | tasks: 30 | - block: 31 | - name: debug device_config 32 | debug: 33 | var: device_config 34 | ``` 35 | 36 | ## Licensing 37 | 38 | GNU General Public License v3.0 or later. 39 | 40 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 41 | 42 | ## Author Information 43 | 44 | Allen Robel (@packetcalc) 45 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_access_mode_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_access_mode_get 2 | 3 | Given ``fabric_name`` return fabric access_mode in var ``read_only`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric to be queried 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_rest_fabric_access_mode_get 27 | vars: 28 | fabric_name: f1 29 | tasks: 30 | - block: 31 | - debug: 32 | msg: "fabric {{ fabric_name }} read_only: {{ read_only }}" 33 | ``` 34 | 35 | ## Licensing 36 | 37 | GNU General Public License v3.0 or later. 38 | 39 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 40 | 41 | ## Author Information 42 | 43 | Allen Robel (@packetcalc) 44 | -------------------------------------------------------------------------------- /roles/ndfc_fabric_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_fabric_config_get 2 | 3 | Retrieve config for ``fabric_name`` from the following sections of ``./inventory/group_vars/ndfc/01_fabrics.yml`` 4 | 5 | - lan_classic_fabrics 6 | - msd_fabrics 7 | - switch_fabrics 8 | - external_fabrics 9 | 10 | ## Role Variables 11 | 12 | Variable | Type | Description 13 | ----------------|--------|---------------------------------------- 14 | fabric_name | string | The fabric configuration to retrieve 15 | 16 | Fabric parameters are defined in the following file: 17 | 18 | - [./inventory/group_vars/ndfc/01_networks.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 19 | 20 | See the following for details: 21 | 22 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 23 | 24 | ## Example Playbook 25 | 26 | ```yaml 27 | --- 28 | - hosts: ndfc 29 | gather_facts: false 30 | roles: 31 | - ndfc_fabric_config_get 32 | vars: 33 | fabric_name: f1 34 | ``` 35 | 36 | ## Licensing 37 | 38 | GNU General Public License v3.0 or later. 39 | 40 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 41 | 42 | ## Author Information 43 | 44 | Allen Robel (@packetcalc) 45 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_network_deleted/tasks/main.yml 2 | --- 3 | 4 | - ansible.builtin.include_role: 5 | name: ndfc_network_config_get 6 | - name: debug network_config 7 | debug: 8 | var: network_config 9 | 10 | - ansible.builtin.include_role: 11 | name: ndfc_network_info_get 12 | vars: 13 | fabric_name: "{{ network_config.fabric }}" 14 | network_name: "{{ network_config.net_name }}" 15 | 16 | # We set wf1 to '' so that we can skip the last task below if it's still equal to '' 17 | - name: set fact wf1 temp 18 | set_fact: 19 | wf1: '' 20 | 21 | - name: worker set_fact wf1 networkName 22 | set_fact: 23 | wf1: "{{ network_info | json_query(wq1) | default('', true) }}" 24 | vars: 25 | wq1: "networkName" 26 | when: "network_info != ''" 27 | 28 | - name: worker deleted FABRIC {{ network_config.fabric }} NETWORK {{ network_config.net_name }} networkName ({{ wf1 }}) 29 | cisco.dcnm.dcnm_network: 30 | fabric: "{{ network_config.fabric }}" 31 | state: deleted 32 | config: 33 | - net_name: "{{ network_config.net_name }}" 34 | when: "wf1 == network_config.net_name" 35 | vars: 36 | ansible_connection: httpapi 37 | 38 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_all_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_generated_configs_all_get 2 | 3 | Query populated generated_config from all devices in fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric in which the devices reside 10 | 11 | Fabric and device parameters are defined in the following files: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Example Playbook 21 | 22 | ```yaml 23 | --- 24 | - hosts: ndfc 25 | gather_facts: false 26 | roles: 27 | - ndfc_device_generated_configs_all_get 28 | vars: 29 | fabric_name: f1 30 | ``` 31 | 32 | ## Licensing 33 | 34 | GNU General Public License v3.0 or later. 35 | 36 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 37 | 38 | ## Author Information 39 | 40 | Allen Robel (@packetcalc) 41 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_rediscover/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_rediscover 2 | 3 | Rediscover device ``device_name`` in fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | device_name | string | The device to be rediscovered 10 | fabric_name | string | The fabric in which ``device_name`` resides 11 | 12 | Device and Fabric names are defined in the following files: 13 | 14 | - ./inventory/group_vars/ndfc/01_fabrics.yml 15 | - ./inventory/group_vars/ndfc/02_devices.yml 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](https://github.com/allenrobel/ndfc-roles/tree/master/inventory/group_vars/README.md) 20 | 21 | ## Example Playbook 22 | 23 | ```yaml 24 | --- 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_rest_device_rediscover 29 | vars: 30 | fabric_name: f1 31 | device_name: spine_1 32 | ``` 33 | 34 | ## Licensing 35 | 36 | GNU General Public License v3.0 or later. 37 | 38 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 39 | 40 | ## Author Information 41 | 42 | Allen Robel (@packetcalc) 43 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_easy_fabric_ebgp/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_easy_fabric_ebgp/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main set_fact nv_pairs {{ fabric_name }} 7 | set_fact: 8 | nv_pairs: "{{ easy_fabric_ebgp.values() | list | json_query(mq1) }}" 9 | vars: 10 | mq1: "[?FABRIC_NAME == '{{ fabric_name }}'] | [0]" 11 | 12 | - name: main REST POST easy_fabric_ebgp {{ fabric_name }} active_fabrics {{ active_fabrics }} 13 | cisco.dcnm.dcnm_rest: 14 | method: POST 15 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 16 | json_data: "{{ vars_dict | to_json }}" 17 | when: "fabric_name not in active_fabrics" 18 | vars: 19 | ansible_connection: httpapi 20 | vars_dict: 21 | fabricName: "{{ fabric_name }}" 22 | fabricType: Switch_Fabric 23 | fabricTypeFriendly": "Switch Fabric" 24 | fabricTechnology: EBGPVXLANFabric 25 | fabricTechnologyFriendly: "eBGP VXLAN Fabric" 26 | provisionMode: DCNMTopDown 27 | deviceType: n9k 28 | templateName: Easy_Fabric_eBGP 29 | nvPairs: "{{ nv_pairs }}" 30 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_msd_child_add/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_msd_child_add 2 | 3 | Add ``child_fabric`` to Multi-Site Domain (MSD) fabric ``msd_fabric`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | child_fabric | string | The fabric to be added to ``msd_fabric`` 10 | msd_fabric | string | The MSD fabric to which ``child_fabric`` will be added 11 | 12 | Fabric parameters are defined in the following file: 13 | 14 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Example Playbook 21 | 22 | Add ``child_fabric`` f1 to ``msd_fabric`` MSD 23 | 24 | ```yaml 25 | --- 26 | - hosts: ndfc 27 | gather_facts: false 28 | roles: 29 | - ndfc_rest_fabric_msd_child_add 30 | vars: 31 | child_fabric: f1 32 | msd_fabric: MSD 33 | ``` 34 | 35 | ## Licensing 36 | 37 | GNU General Public License v3.0 or later. 38 | 39 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 40 | 41 | ## Author Information 42 | 43 | Allen Robel (@packetcalc) 44 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_rediscover/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_rediscover/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_device_config_get 5 | 6 | - name: query FABRIC {{ device_config.switch_fabric }} ROLE {{ device_config.role }} NAME {{ device_name }} IP {{ device_config.ip }} 7 | cisco.dcnm.dcnm_inventory: 8 | fabric: "{{ device_config.switch_fabric }}" 9 | state: query 10 | config: 11 | - seed_ip: "{{ device_config.ip }}" 12 | register: result 13 | 14 | - name: set_fact device_id FABRIC {{ device_config.switch_fabric }} ROLE {{ device_config.role }} NAME {{ device_name }} IP {{ device_config.ip }} 15 | set_fact: 16 | device_id: "{{ result.response | json_query(q2) | to_json }}" 17 | vars: 18 | q2: "[0].switchDbID" 19 | 20 | - name: worker REST POST rediscoverSwitch FABRIC {{ device_config.switch_fabric }} ROLE {{ device_config.role }} NAME {{ device_name }} IP {{ device_config.ip }} DEVICE_ID {{ device_id }} 21 | cisco.dcnm.dcnm_rest: 22 | method: POST 23 | path: "/appcenter/cisco/ndfc/api/v1/lan-discovery/rediscoverSwitch" 24 | json_data: "{{ vars_list | to_json }}" 25 | when: "device_id != None" 26 | vars: 27 | vars_list: 28 | - "{{ device_id }}" 29 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_service_node_config_get 2 | 3 | Retrieve local configuration for ``service_node_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ------------------|--------|---------------------------------------- 9 | service_node_name | string | The service node for which local configuration information is retrieved 10 | 11 | Service node parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/06_service_nodes.yml](/inventory/group_vars/ndfc/06_service_nodes.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_service_node_config_get 27 | vars: 28 | service_node_name: sn_1 29 | tasks: 30 | - block: 31 | - name: debug service_node_config 32 | debug: 33 | var: service_node_config 34 | ``` 35 | 36 | ## Licensing 37 | 38 | GNU General Public License v3.0 or later. 39 | 40 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 41 | 42 | ## Author Information 43 | 44 | Allen Robel (@packetcalc) 45 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted_all/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_network_deleted_all 2 | 3 | Delete all networks in fabric ``fabric_name`` 4 | 5 | NOTE: If the networks were created in an MSD fabric, Ansible will throw an InvalidFabric error if you set ``fabric_name`` to that of a child/switch fabric. 6 | 7 | ## Role Variables 8 | 9 | Variable | Type | Description 10 | ----------------|--------|---------------------------------------- 11 | fabric_name | string | The fabric from which to delete all networks. 12 | 13 | Fabric parameters are defined in the following file: 14 | 15 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 20 | 21 | ## Example Playbooks 22 | 23 | ### Delete all networks in external fabric_name f1 24 | 25 | ```yaml 26 | --- 27 | - hosts: ndfc 28 | gather_facts: false 29 | roles: 30 | - ndfc_network_deleted_all 31 | vars: 32 | fabric_name: MSD 33 | ``` 34 | 35 | ## Licensing 36 | 37 | GNU General Public License v3.0 or later. 38 | 39 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 40 | 41 | ## Author Information 42 | 43 | Allen Robel (@packetcalc) 44 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_intra_tenant_fw_merged/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_service_route_peering_intra_tenant_fw_merged 2 | 3 | Create intra-tenant service route peering 4 | 5 | NOTE 1: This role is not tested (or documented satisfactorily) yet. 6 | 7 | ## Role Variables 8 | 9 | Variable | Type | Description 10 | ---------------------------|-------|---------------------------------------- 11 | service_route_peering_name | string | The name of the service route peering 12 | 13 | Service route peerings are defined in the following file under ``service_route_peerings` 14 | 15 | - [./inventory/group_vars/ndfc/06_service_nodes.yml](/inventory/group_vars/ndfc/06_service_nodes.yml) 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 20 | 21 | ## Example Playbook 22 | 23 | ```yaml 24 | --- 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_service_route_peering_intra_tenant_fw_merged 29 | vars: 30 | service_route_peering_name: srp_1 31 | ``` 32 | 33 | ## Licensing 34 | 35 | GNU General Public License v3.0 or later. 36 | 37 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 38 | 39 | ## Author Information 40 | 41 | Allen Robel (@packetcalc) 42 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_config_deploy 2 | 3 | Issue NDFC POST REST API calls to invoke config-save on ``fabric_name`` and config-deploy on fabric ``fabric_name`` device ``device_name``. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | -------------------|---------|------------ 9 | device_name | string | Device ``name`` in devices dictionary [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 10 | 11 | Default values for the following variables are set in [./roles/ndfc_rest_config_deploy/defaults/main.yml](/roles/ndfc_rest_config_deploy/defaults/main.yml): 12 | 13 | Variable | Type | Description 14 | -------------------|---------|------------ 15 | forceShowRun | boolean | default, false 16 | inclAllMSDSwitches | boolean | default, false 17 | 18 | ## Example Playbook 19 | 20 | ```yaml 21 | --- 22 | - hosts: ndfc 23 | gather_facts: false 24 | roles: 25 | - ndfc_rest_config_deploy 26 | vars: 27 | device_name: leaf_1 28 | ``` 29 | 30 | ## Licensing 31 | 32 | GNU General Public License v3.0 or later. 33 | 34 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 35 | 36 | ## Author Information 37 | 38 | Allen Robel (@packetcalc) 39 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_msd_child_remove/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_msd_child_remove 2 | 3 | Remove child fabric ``child_fabric`` from Multi-Site Domain (MSD) fabric ``msd_fabric`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | child_fabric | string | The fabric to be removed from ``msd_fabric`` 10 | msd_fabric | string | The MSD fabric from which ``child_fabric`` will be removed 11 | 12 | Fabric parameters are defined in the following file: 13 | 14 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Example Playbook 21 | 22 | Remove ``child_fabric`` f1 from ``msd_fabric`` MSD 23 | 24 | ```yaml 25 | --- 26 | - hosts: ndfc 27 | gather_facts: false 28 | roles: 29 | - ndfc_rest_fabric_msd_child_remove 30 | vars: 31 | child_fabric: f1 32 | msd_fabric: MSD 33 | ``` 34 | 35 | ## Licensing 36 | 37 | GNU General Public License v3.0 or later. 38 | 39 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 40 | 41 | ## Author Information 42 | 43 | Allen Robel (@packetcalc) 44 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced_all/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_network_replaced_all 2 | 3 | Replace all networks in fabric ``fabric_name`` with their current definitions in Replace all networks in fabric ``fabric_name`` with their current definitions in ``./roles/ndfc_common/vars/main.yml`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric in which the networks reside 10 | 11 | Fabric and network parameters are defined in the following files: 12 | 13 | - [./inventory/group_vars/ndfc/01_networks.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | ## Example Playbook 21 | 22 | ```yaml 23 | --- 24 | - hosts: ndfc 25 | gather_facts: false 26 | roles: 27 | - ndfc_network_replaced_all 28 | vars: 29 | fabric_name: MSD 30 | ``` 31 | 32 | ## Licensing 33 | 34 | GNU General Public License v3.0 or later. 35 | 36 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 37 | 38 | ## Author Information 39 | 40 | Allen Robel (@packetcalc) 41 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vrf_list_by_fabric/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_vrf_list_by_fabric 2 | 3 | Retrieve list of VRFs in fabric ``fabric_name`` 4 | 5 | Returns JSON object ``info`` which will be a list of vrf dictionaries 6 | if the GET request succeeded, or an empty list if the GET request failed. 7 | 8 | ## Role Variables 9 | 10 | Variable | Type | Description 11 | ----------------|-------|---------------------------------------- 12 | fabric_name | str() | The fabric to be queried 13 | 14 | ## Example Playbook 15 | 16 | The playbook below prints select information for every VRF in fabric_name f2. 17 | 18 | ```yaml 19 | --- 20 | - hosts: ndfc 21 | gather_facts: false 22 | roles: 23 | - ndfc_rest_vrf_list_by_fabric 24 | vars: 25 | fabric_name: f2 26 | tasks: 27 | - debug: 28 | msg: "vrfName: {{ item.vrfName }} vrfId {{ item.vrfId }} vrfStatus {{ item.vrfStatus }}" 29 | loop: "{{ info | json_query(q1) }}" 30 | vars: 31 | q1: "[*].{ vrfId: vrfId, vrfName: vrfName, vrfStatus: vrfStatus }" 32 | loop_control: 33 | label: vrf_info 34 | ``` 35 | 36 | ## Licensing 37 | 38 | GNU General Public License v3.0 or later. 39 | 40 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 41 | 42 | ## Author Information 43 | 44 | Allen Robel (@packetcalc) 45 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced_all/tasks/worker.yml: -------------------------------------------------------------------------------- 1 | # ndfc_network_replaced_all/tasks/worker.yml 2 | # 2023-04-11: Added a temporary workaround for an issue where one of the following 3 | # errors are thrown due to changes in DCNM Ansible Collection version 2.4.0: 4 | # Invalid: Fabric mode is not multicast and Multicast Address: 239.1.1.0 is present 5 | # Invalid: Ingress Replication is true and Multicast Address is 239.1.1.0 6 | # See the following issue: 7 | # https://github.com/CiscoDevNet/ansible-dcnm/issues/185 8 | # The workaround is to add multicast_group_address: "" to config: 9 | # 2023-04-11: Update: This still seems broken in cisco.dcnm version 3.1.1 so keeping the workaround. 10 | - name: worker replaced FABRIC {{ network.value.fabric }} NETWORK {{ network.value.net_name }} VRF {{ network.value.vrf_name }} VLAN {{ network.value.vlan_id }} SUBNET {{ network.value.gw_ip_subnet }}" 11 | cisco.dcnm.dcnm_network: 12 | fabric: "{{ fabric_name }}" 13 | state: replaced 14 | config: 15 | - net_name: "{{ network.value.net_name }}" 16 | multicast_group_address: "" 17 | vrf_name: "{{ network.value.vrf_name }}" 18 | vlan_id: "{{ network.value.vlan_id }}" 19 | gw_ip_subnet: "{{ network.value.gw_ip_subnet }}" 20 | attach: "{{ network.value.attach }}" 21 | vars: 22 | ansible_connection: httpapi 23 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vpc_create/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_vpc_create 2 | 3 | Create vpc peering ``vpc_name`` in fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric in which the vpc peering resides 10 | vpc_name | string | The name of the vpc peering to create 11 | 12 | NOTE 1: ``fabric_name`` is required by ndfc_rest_config_deploy_all 13 | 14 | Fabric and VPC parameters are defined in the following files: 15 | 16 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 17 | - [./inventory/group_vars/ndfc/05_vpc.yml](/inventory/group_vars/ndfc/05_vpc.yml) 18 | 19 | See the following for details: 20 | 21 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 22 | 23 | ## Example Playbook 24 | 25 | ```yaml 26 | --- 27 | - hosts: ndfc 28 | gather_facts: false 29 | roles: 30 | - ndfc_rest_vpc_create 31 | - ndfc_rest_config_deploy_all 32 | vars: 33 | fabric_name: f2 34 | vpc_name: vpc2 35 | ``` 36 | 37 | ## Licensing 38 | 39 | GNU General Public License v3.0 or later. 40 | 41 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 42 | 43 | ## Author Information 44 | 45 | Allen Robel (@packetcalc) 46 | -------------------------------------------------------------------------------- /roles/ndfc_device_interface_config_all_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_interface_config_all_get 2 | 3 | Query the config for a specific interface across all devices in fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric in which the devices reside 10 | interface_name | string | An NX-OS interface name e.g. Ethernet1/12, Port-channel11, Loopback1, etc 11 | 12 | Fabric and interface parameters are defined in the following files: 13 | 14 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 15 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 20 | 21 | ## Example Playbook 22 | 23 | ```yaml 24 | --- 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_device_interface_config_all_get 29 | vars: 30 | fabric_name: f1 31 | interface_name: Ethernet1/11 32 | ``` 33 | 34 | ## Licensing 35 | 36 | GNU General Public License v3.0 or later. 37 | 38 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 39 | 40 | ## Author Information 41 | 42 | Allen Robel (@packetcalc) 43 | -------------------------------------------------------------------------------- /roles/ndfc_device_generated_configs_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_generated_configs_get 2 | 3 | Retrieve populated generated configs from ``device_name`` in fabric ``fabric_name`` 4 | 5 | Store in variable ``device_generated_configs`` 6 | 7 | ## Role Variables 8 | 9 | Variable | Type | Description 10 | ----------------|--------|---------------------------------------- 11 | device_name | string | The device to query 12 | 13 | Fabric and device parameters are defined in the following files: 14 | 15 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 16 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 17 | 18 | See the following for details: 19 | 20 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 21 | 22 | ## Example Playbook 23 | 24 | ```yaml 25 | --- 26 | - hosts: ndfc 27 | gather_facts: false 28 | roles: 29 | - ndfc_device_generated_configs_get 30 | vars: 31 | device_name: leaf_1 32 | tasks: 33 | - block: 34 | - debug: 35 | var: device_generated_configs 36 | when: "device_generated_configs != ''" 37 | ``` 38 | 39 | ## Licensing 40 | 41 | GNU General Public License v3.0 or later. 42 | 43 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 44 | 45 | ## Author Information 46 | 47 | Allen Robel (@packetcalc) 48 | -------------------------------------------------------------------------------- /roles/ndfc_device_serial_number_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_serial_number_get 2 | 3 | Return ``device_serial_number`` given ``device_name``. 4 | 5 | The device's serial number is returned in variable ``device_serial_number``. 6 | 7 | ## Role Variables 8 | 9 | Variable | Type | Description 10 | ----------------|--------|---------------------------------------- 11 | device_name | string | The device to be queried 12 | 13 | Device parameters are defined in the following file: 14 | 15 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 20 | 21 | ## Example Playbook 22 | 23 | ```yaml 24 | # Query NX-OS switch associated with fabric_name + device_name 25 | # and print device's serial number 26 | --- 27 | - hosts: ndfc 28 | gather_facts: false 29 | roles: 30 | - ndfc_device_serial_get 31 | vars: 32 | device_name: leaf_1 33 | tasks: 34 | - block: 35 | - debug: 36 | msg: "device_serial_number: {{ device_serial_number }}" 37 | when: "device_serial_number != ''" 38 | ``` 39 | 40 | ## Licensing 41 | 42 | GNU General Public License v3.0 or later. 43 | 44 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 45 | 46 | ## Author Information 47 | 48 | Allen Robel (@packetcalc) 49 | -------------------------------------------------------------------------------- /roles/ndfc_service_route_peering_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_service_route_peering_config_get 2 | 3 | Retrieve configuration for ``service_route_peering_name`` from the Ansible inventory 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ---------------------------|--------|---------------------------------------- 9 | service_route_peering_name | string | The service route peering for which local configuration information is retrieved 10 | 11 | Service route peerings are defined in the following file under ``service_route_peerings` 12 | 13 | - [./inventory/group_vars/ndfc/06_service_nodes.yml](/inventory/group_vars/ndfc/06_service_nodes.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbook 20 | 21 | ```yaml 22 | --- 23 | - hosts: ndfc 24 | gather_facts: false 25 | roles: 26 | - ndfc_service_route_peering_config_get 27 | vars: 28 | service_route_peering_name: srp_1 29 | tasks: 30 | - block: 31 | - name: debug service_route_peering_config 32 | debug: 33 | var: service_route_peering_config 34 | ``` 35 | 36 | ## Licensing 37 | 38 | GNU General Public License v3.0 or later. 39 | 40 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 41 | 42 | ## Author Information 43 | 44 | Allen Robel (@packetcalc) 45 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_shutdown/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_interface_shutdown/tasks/main.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_device_config_get 4 | 5 | - name: query FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} 6 | cisco.dcnm.dcnm_inventory: 7 | fabric: "{{ device_config.switch_fabric }}" 8 | state: query 9 | config: 10 | - seed_ip: "{{ device_config.ip }}" 11 | register: wr1 12 | 13 | - ansible.builtin.include_role: 14 | name: ndfc_device_serial_number_get 15 | 16 | - name: REST POST interface shutdown FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} SERIAL {{ device_serial_number }} INTERFACE {{ interface_name }} payload {{ payload }} 17 | cisco.dcnm.dcnm_rest: 18 | method: POST 19 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface/adminstatus" 20 | json_data: "{{ payload | to_json }}" 21 | when: "device_serial_number != ''" 22 | vars: 23 | ansible_connection: httpapi 24 | payload: 25 | operation: "shut" 26 | interfaces: 27 | - serialNumber: "{{ device_serial_number }}" 28 | ifName: "{{ interface_name }}" 29 | 30 | - ansible.builtin.include_role: 31 | name: ndfc_rest_config_deploy 32 | vars: 33 | device_name: "{{ device_config.name }}" 34 | when: "device_serial_number != ''" 35 | -------------------------------------------------------------------------------- /roles/ndfc_device_names_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_names_get 2 | 3 | Use ``set_fact`` to set a list (``device_names``) of device names matching devices in fabric ``fabric_name`` with role ``role``. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric name to match 10 | role | string | The device role to match e.g. leaf, spine, border_gateway 11 | 12 | Fabric and device parameters are defined in the following files: 13 | 14 | - ./inventory/group_vars/ndfc/01_fabrics.yml 15 | - ./inventory/group_vars/ndfc/02_devices.yml 16 | 17 | See the following for details. 18 | 19 | [./inventory/group_vars/README.md](https://github.com/allenrobel/ndfc-roles/tree/master/inventory/group_vars/README.md) 20 | 21 | ## Example Playbook 22 | 23 | ```yaml 24 | --- 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_device_names_get 29 | vars: 30 | fabric_name: f1 31 | role: leaf 32 | tasks: 33 | - block: 34 | - debug: 35 | msg: "device_names: {{ device_names }}" 36 | when: "device_names != ''" 37 | ``` 38 | 39 | ## Licensing 40 | 41 | GNU General Public License v3.0 or later. 42 | 43 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 44 | 45 | ## Author Information 46 | 47 | Allen Robel (@packetcalc) 48 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_asn_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_asn_get 2 | 3 | Given ``fabric_name`` return fabric BGP ASN in var ``fabric_asn`` 4 | 5 | ## Returned variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_asn | string | The BGP AS of the queried fabric 10 | 11 | ## Role Variables 12 | 13 | Variable | Type | Description 14 | ----------------|--------|---------------------------------------- 15 | fabric_name | string | The fabric to be queried 16 | 17 | Fabric parameters are defined in the following file: 18 | 19 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 20 | 21 | See the following for details: 22 | 23 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 24 | 25 | ## Example Playbooks 26 | 27 | ```yaml 28 | --- 29 | - hosts: ndfc 30 | gather_facts: false 31 | roles: 32 | - ndfc_rest_fabric_asn_get 33 | vars: 34 | fabric_name: f1 35 | tasks: 36 | - block: 37 | - debug: 38 | msg: "fabric_name {{ fabric_name }} fabric_asn: {{ fabric_asn }}" 39 | when: "fabric_asn != ''" 40 | ``` 41 | 42 | ## Licensing 43 | 44 | GNU General Public License v3.0 or later. 45 | 46 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 47 | 48 | ## Author Information 49 | 50 | Allen Robel (@packetcalc) 51 | -------------------------------------------------------------------------------- /roles/ndfc_network_replaced/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_network_replaced/tasks/main.yml 2 | # 2023-01-04: Added a temporary workaround for an issue where one of the following 3 | # errors are thrown due to changes in DCNM Ansible Collection version 2.4.0: 4 | # Invalid: Fabric mode is not multicast and Multicast Address: 239.1.1.0 is present 5 | # Invalid: Ingress Replication is true and Multicast Address is 239.1.1.0 6 | # See the following issue: 7 | # https://github.com/CiscoDevNet/ansible-dcnm/issues/185 8 | # The workaround is to add multicast_group_address: "" to config: 9 | # 2023-04-11: Update: This still seems broken in cisco.dcnm version 3.1.1 so keeping the workaround. 10 | - ansible.builtin.include_role: 11 | name: ndfc_network_config_get 12 | 13 | - name: worker replaced FABRIC {{ network_config.fabric }} NETWORK {{ network_config.net_name }} VRF {{ network_config.vrf_name }} VLAN {{ network_config.vlan_id }} SUBNET {{ network_config.gw_ip_subnet }}" 14 | cisco.dcnm.dcnm_network: 15 | fabric: "{{ network_config.fabric }}" 16 | state: replaced 17 | config: 18 | - net_name: "{{ network_config.net_name }}" 19 | multicast_group_address: "" 20 | vrf_name: "{{ network_config.vrf_name }}" 21 | vlan_id: "{{ network_config.vlan_id }}" 22 | gw_ip_subnet: "{{ network_config.gw_ip_subnet }}" 23 | attach: "{{ network_config.attach }}" 24 | vars: 25 | ansible_connection: httpapi 26 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_create_easy_fabric/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_create_easy_fabric/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: main set_fact nv_pairs {{ fabric_name }} 7 | set_fact: 8 | nv_pairs: "{{ easy_fabric.values() | list | json_query(mq1) }}" 9 | vars: 10 | mq1: "[?FABRIC_NAME == '{{ fabric_name }}'] | [0]" 11 | 12 | - name: main REST POST easy_fabric {{ fabric_name }} active_fabrics {{ active_fabrics }} 13 | cisco.dcnm.dcnm_rest: 14 | method: POST 15 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics" 16 | json_data: "{{ vars_dict | to_json }}" 17 | when: "fabric_name not in active_fabrics" 18 | vars: 19 | ansible_connection: httpapi 20 | vars_dict: 21 | fabricName: "{{ fabric_name }}" 22 | fabricType: Switch_Fabric 23 | fabricTypeFriendly": "Switch Fabric" 24 | fabricTechnology: VXLANFabric 25 | fabricTechnologyFriendly: "VXLAN Fabric" 26 | provisionMode: DCNMTopDown 27 | deviceType: n9k 28 | templateName: Easy_Fabric 29 | vrfTemplate: Default_VRF_Universal 30 | networkTemplate: Default_Network_Universal 31 | vrfExtensionTemplate: Default_VRF_Extension_Universal 32 | networkExtensionTemplate: Default_Network_Extension_Universal 33 | nvPairs: "{{ nv_pairs }}" 34 | -------------------------------------------------------------------------------- /roles/ndfc_network_deleted/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_network_deleted 2 | 3 | Delete network ``network_name`` where ``network_name`` matches the ``name`` key in the local ``networks`` dictionary in [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | network_name | string | The network to be deleted 10 | 11 | Network parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Example Playbooks 20 | 21 | ### Delete network_name f1_n1111 22 | 23 | ```yaml 24 | --- 25 | - hosts: ndfc 26 | gather_facts: false 27 | roles: 28 | - ndfc_network_deleted 29 | vars: 30 | network_name: f1_n1111 31 | ``` 32 | 33 | ### Delete network_name msd_n1111, which resides in fabric MSD (an msd fabric) 34 | 35 | This will delete network_name msd_n1111 from all child fabrics of fabric MSD. 36 | 37 | ```yaml 38 | --- 39 | - hosts: ndfc 40 | gather_facts: false 41 | roles: 42 | - ndfc_network_deleted 43 | vars: 44 | network_name: msd_n1111 45 | ``` 46 | 47 | ## License 48 | 49 | BSD 50 | 51 | ## Author Information 52 | 53 | Allen Robel (@packetcalc) 54 | -------------------------------------------------------------------------------- /roles/ndfc_rest_config_deploy_all/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_config_deploy_all 2 | 3 | Issue NDFC POST REST API calls to invoke config-save and config-deploy in fabric ``fabric_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | -------------------|---------|------------ 9 | fabric_name | string | The fabric to config-save and config-deploy 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | Default values for the following variables are set in [./roles/ndfc_rest_config_deploy_all/defaults/main.yml](/roles/ndfc_rest_config_deploy_all/defaults/main.yml): 20 | 21 | Variable | Type | Description 22 | -------------------|---------|------------ 23 | forceShowRun | boolean | default, false 24 | inclAllMSDSwitches | boolean | default, false 25 | 26 | ## Example Playbook 27 | 28 | ```yaml 29 | --- 30 | - hosts: ndfc 31 | gather_facts: false 32 | roles: 33 | - ndfc_rest_config_deploy_all 34 | vars: 35 | fabric_name: f1 36 | ``` 37 | 38 | ## Licensing 39 | 40 | GNU General Public License v3.0 or later. 41 | 42 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 43 | 44 | ## Author Information 45 | 46 | Allen Robel (@packetcalc) 47 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_no_shutdown/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_interface_no_shutdown/tasks/main.yml 2 | - ansible.builtin.include_role: 3 | name: ndfc_device_config_get 4 | 5 | - name: query FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} 6 | cisco.dcnm.dcnm_inventory: 7 | fabric: "{{ device_config.switch_fabric }}" 8 | state: query 9 | config: 10 | - seed_ip: "{{ device_config.ip }}" 11 | register: wr1 12 | vars: 13 | ansible_connection: httpapi 14 | 15 | - ansible.builtin.include_role: 16 | name: ndfc_device_serial_number_get 17 | 18 | - name: REST POST interface no_shutdown FABRIC {{ device_config.switch_fabric }} NAME {{ device_config.name }} IP {{ device_config.ip }} SERIAL {{ device_serial_number }} INTERFACE {{ interface_name }} payload {{ payload }} 19 | cisco.dcnm.dcnm_rest: 20 | method: POST 21 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface/adminstatus" 22 | json_data: "{{ payload | to_json }}" 23 | vars: 24 | ansible_connection: httpapi 25 | payload: 26 | operation: "noshut" 27 | interfaces: 28 | - serialNumber: "{{ device_serial_number }}" 29 | ifName: "{{ interface_name }}" 30 | when: "device_serial_number != ''" 31 | 32 | - ansible.builtin.include_role: 33 | name: ndfc_rest_config_deploy 34 | vars: 35 | device_name: "{{ device_config.name }}" 36 | when: "device_serial_number != ''" 37 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_msd_child_add/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_msd_add_child/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | # query fabric-associations for child_fabric's fabric_parent 7 | - name: main REST GET fabric_associations 8 | cisco.dcnm.dcnm_rest: 9 | method: GET 10 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations/" 11 | register: mr2 12 | vars: 13 | ansible_connection: httpapi 14 | - name: main set_fact fabric_parent 15 | set_fact: 16 | fabric_parent: "{{ mr2.response.DATA | json_query(mq2) }}" 17 | vars: 18 | mq2: "[?fabricName == '{{ child_fabric }}'].{fabricParent: fabricParent}" 19 | 20 | # Add child_fabric to msd_fabric if child_fabric's fabric_parent == None and both msd_fabric and child_fabric exists 21 | - name: main REST POST msdAdd msd_fabric {{ msd_fabric }} child_fabric {{ child_fabric }} fabric_parent {{ fabric_parent[0].fabricParent }} 22 | cisco.dcnm.dcnm_rest: 23 | method: POST 24 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msdAdd" 25 | json_data: "{{ vars_dict | to_json }}" 26 | when: "msd_fabric in active_fabrics and child_fabric in active_fabrics and fabric_parent[0].fabricParent == 'None'" 27 | vars: 28 | ansible_connection: httpapi 29 | vars_dict: 30 | destFabric: "{{ msd_fabric }}" 31 | sourceFabric: "{{ child_fabric }}" 32 | -------------------------------------------------------------------------------- /issues_1.md: -------------------------------------------------------------------------------- 1 | The following example playbook fails when using cisco.dcnm version 2.4.0 (as do similar tasks in other playbooks). 2 | 3 | ```yaml 4 | - hosts: ndfc 5 | gather_facts: false 6 | roles: 7 | - ndfc_network_replaced_all 8 | vars: 9 | fabric_name: MSD 10 | ``` 11 | 12 | The error returned is, variously: 13 | 14 | ```bash 15 | "Invalid: Fabric mode is not multicast and Multicast Address: 239.1.1.0 is present", 16 | 17 | or 18 | 19 | "Invalid: Ingress Replication is true and Multicast Address is 239.1.1.0" 20 | ``` 21 | 22 | There are two known workarounds: 23 | 24 | 1. Downgrade to cisco.dcnm 2.3.0 25 | 2. If running cisco.dcnm 2.4.0, set ``multicast_group_address: ""`` in roles/ndfc_network_replaced_all/tasks/worker.yml, like so: 26 | 27 | ```yaml 28 | # ndfc_network_replaced_all/tasks/worker.yml 29 | - name: worker replaced FABRIC {{ network.value.fabric }} NETWORK {{ network.value.net_name }} VRF {{ network.value.vrf_name }} VLAN {{ network.value.vlan_id }} SUBNET {{ network.value.gw_ip_subnet }}" 30 | cisco.dcnm.dcnm_network: 31 | fabric: "{{ fabric_name }}" 32 | state: replaced 33 | config: 34 | - net_name: "{{ network.value.net_name }}" 35 | multicast_group_address: "" 36 | vrf_name: "{{ network.value.vrf_name }}" 37 | vlan_id: "{{ network.value.vlan_id }}" 38 | gw_ip_subnet: "{{ network.value.gw_ip_subnet }}" 39 | attach: "{{ network.value.attach }}" 40 | vars: 41 | ansible_connection: httpapi 42 | ``` 43 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_msd_child_remove/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_msd_remove_child/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | # query fabric-associations for child_fabric's fabric_parent 7 | - name: main REST GET fabric_associations 8 | cisco.dcnm.dcnm_rest: 9 | method: GET 10 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations/" 11 | register: mr2 12 | vars: 13 | ansible_connection: httpapi 14 | - name: main set_fact fabric_parent 15 | set_fact: 16 | fabric_parent: "{{ mr2.response.DATA | json_query(mq2) }}" 17 | vars: 18 | mq2: "[?fabricName == '{{ child_fabric }}'].{fabricParent: fabricParent}" 19 | 20 | # Remove child_fabric to msd_fabric if child_fabric's fabric_parent != None and both msd_fabric and child_fabric exists 21 | - name: main REST POST msdExit msd_fabric {{ msd_fabric }} child_fabric {{ child_fabric }} fabric_parent ({{ fabric_parent[0].fabricParent }}) 22 | cisco.dcnm.dcnm_rest: 23 | method: POST 24 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msdExit" 25 | json_data: "{{ vars_dict | to_json }}" 26 | when: "msd_fabric in active_fabrics and child_fabric in active_fabrics and fabric_parent[0].fabricParent != 'None'" 27 | vars: 28 | ansible_connection: httpapi 29 | vars_dict: 30 | destFabric: "{{ msd_fabric }}" 31 | sourceFabric: "{{ child_fabric }}" 32 | -------------------------------------------------------------------------------- /roles/ndfc_device_model_number_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_model_number_get 2 | 3 | Retrieve ``device_model_number`` from NDFC controller, given ``device_name``. 4 | 5 | The device's model number is returned in variable ``device_model_number``. 6 | 7 | ## Role Variables 8 | 9 | Variable | Type | Description 10 | ----------------|--------|---------------------------------------- 11 | device_name | string | The device to be queried 12 | 13 | Fabric and device parameters are defined in the following files: 14 | 15 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 16 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 17 | 18 | See the following for details: 19 | 20 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 21 | 22 | ## Example Playbook 23 | 24 | ```yaml 25 | # Query NX-OS switch associated with fabric_name + device_name 26 | # and print device's model number 27 | --- 28 | - hosts: ndfc 29 | gather_facts: false 30 | roles: 31 | - ndfc_device_model_number_get 32 | vars: 33 | device_name: leaf_1 34 | tasks: 35 | - block: 36 | - debug: 37 | msg: "device_model_number: {{ device_model_number }}" 38 | when: "device_model_number != ''" 39 | ``` 40 | 41 | ## Licensing 42 | 43 | GNU General Public License v3.0 or later. 44 | 45 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 46 | 47 | ## Author Information 48 | 49 | Allen Robel (@packetcalc) 50 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_intent_config_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_intent_config_get 2 | 3 | Retrieve intended config for ``device_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | -------------------|---------|------------ 9 | device_name | string | Device ``name`` in devices dictionary 10 | 11 | Device parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | Default values for the following variables are set in [./roles/ndfc_rest_config_deploy/defaults/main.yml](/roles/ndfc_rest_config_deploy/defaults/main.yml): 20 | 21 | Variable | Type | Description 22 | -------------------|---------|------------ 23 | forceShowRun | boolean | default, false 24 | inclAllMSDSwitches | boolean | default, false 25 | 26 | ## Example Playbook 27 | 28 | ```yaml 29 | --- 30 | - hosts: ndfc 31 | gather_facts: false 32 | roles: 33 | - ndfc_rest_device_intent_config_get 34 | vars: 35 | device_name: leaf_1 36 | tasks: 37 | - block: 38 | - name: debug device_intent_config 39 | debug: 40 | var: device_intent_config 41 | ``` 42 | 43 | ## Licensing 44 | 45 | GNU General Public License v3.0 or later. 46 | 47 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 48 | 49 | ## Author Information 50 | 51 | Allen Robel (@packetcalc) 52 | -------------------------------------------------------------------------------- /roles/ndfc_rest_fabric_info_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_fabric_info_get 2 | 3 | Returns information for ``fabric_name`` in variable ``fabric_info`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric to be queried 10 | 11 | Fabric parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | ## Default Variables 20 | 21 | Defaults for the following are in [./roles/ndfc_rest_fabric_info_get/defaults/main.yml](/roles/ndfc_rest_fabric_info_get/defaults/main.yml) 22 | 23 | Variable | Type | Description 24 | ----------------------|--------|---------------------------------------- 25 | greenfield_debug_flag | str() | Default: enable 26 | IS_READ_ONLY | bool() | Default: false 27 | 28 | ## Example Playbook 29 | 30 | ```yaml 31 | --- 32 | - hosts: ndfc 33 | gather_facts: false 34 | roles: 35 | - ndfc_rest_fabric_info_get 36 | vars: 37 | fabric_name: MSD 38 | tasks: 39 | - block: 40 | - name: debug fabric_info 41 | debug: 42 | var: fabric_info 43 | ``` 44 | 45 | ## Licensing 46 | 47 | GNU General Public License v3.0 or later. 48 | 49 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 50 | 51 | ## Author Information 52 | 53 | Allen Robel (@packetcalc) 54 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policies and Procedures 2 | 3 | This document outlines security procedures and general policies for the 4 | `` project. 5 | 6 | - [Reporting a Bug](#reporting-a-bug) 7 | - [Disclosure Policy](#disclosure-policy) 8 | - [Comments on this Policy](#comments-on-this-policy) 9 | 10 | ## Reporting a Bug 11 | 12 | The `ndfc-roles` team and community take all security bugs in 13 | `ndfc-roles` seriously. Thank you for improving the security of 14 | `ndfc-roles`. We appreciate your efforts and responsible disclosure and 15 | will make every effort to acknowledge your contributions. 16 | 17 | Report security bugs by emailing `oss-security@cisco.com`. 18 | 19 | The lead maintainer will acknowledge your email within 48 hours, and will send a 20 | more detailed response within 48 hours indicating the next steps in handling 21 | your report. After the initial reply to your report, the security team will 22 | endeavor to keep you informed of the progress towards a fix and full 23 | announcement, and may ask for additional information or guidance. 24 | 25 | ## Disclosure Policy 26 | 27 | When the security team receives a security bug report, they will assign it to a 28 | primary handler. This person will coordinate the fix and release process, 29 | involving the following steps: 30 | 31 | - Confirm the problem and determine the affected versions. 32 | - Audit code to find any potential similar problems. 33 | - Prepare fixes for all releases still under maintenance. These fixes will be 34 | released as quickly as possible. 35 | 36 | ## Comments on this Policy 37 | 38 | If you have suggestions on how this process could be improved please submit a 39 | pull request. 40 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_set_role/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_set_role 2 | 3 | Set role for device ``device_name``. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | device_name | string | The device to be merged 10 | role | string | The desired role for ``device_name`` e.g. leaf, spine, border_gateway, etc 11 | 12 | Device parameters are defined in the following file: 13 | 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | Other variables used in this Role: 21 | 22 | Defaults for the following are in [./roles/ndfc_rest_device_set_role/defaults/main.yml](/roles/ndfc_rest_device_set_role/defaults/main.yml) 23 | 24 | Variable | Type | Description 25 | -------------------|---------|------------ 26 | forceShowRun | boolean | Default: ``false`` Included in the config-deploy REST call payload. 27 | inclAllMSDSwitches | boolean | Default: ``false`` Included in the config-deploy REST call payload. 28 | 29 | ## Dependencies 30 | 31 | ## Example Playbooks 32 | 33 | ```yaml 34 | --- 35 | - hosts: ndfc 36 | gather_facts: false 37 | roles: 38 | - ndfc_rest_device_set_role 39 | vars: 40 | - fabric_name: f1 41 | device_name: spine_1 42 | role: spine 43 | ``` 44 | 45 | ## Licensing 46 | 47 | GNU General Public License v3.0 or later. 48 | 49 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 50 | 51 | ## Author Information 52 | 53 | Allen Robel (@packetcalc) 54 | -------------------------------------------------------------------------------- /roles/ndfc_network_info_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_network_info_get 2 | 3 | Query the NDFC controller and retrieve ``network_info`` dictionary given ``network_name`` 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | network_name | string | The network for which to retrieve ``network_info`` dictionary 10 | 11 | Network parameters are defined in the following file: 12 | 13 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 14 | 15 | See the following for details: 16 | 17 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 18 | 19 | NOTE: ``network_name`` must match value in network entry's ``name:`` key (i.e. don't try to match on the value of the ``net_name:`` key). 20 | 21 | ## Returned Variables 22 | 23 | Variable | Type | Description 24 | ----------------|------|---------------------------------------- 25 | network_info | dict | information pertaining to network ``network_name`` 26 | 27 | ## Example Playbooks 28 | 29 | Retrieve ``network_info`` dictionary for ``network_name`` msd_n1111 30 | 31 | ```yaml 32 | --- 33 | - hosts: ndfc 34 | gather_facts: false 35 | roles: 36 | - ndfc_network_info_get 37 | vars: 38 | network_name: msd_n1111 39 | tasks: 40 | - block: 41 | - debug: 42 | msg: "network_info: {{ network_info | default('unable to find network. Check network_name.', true) }}" 43 | ``` 44 | 45 | ## Licensing 46 | 47 | GNU General Public License v3.0 or later. 48 | 49 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 50 | 51 | ## Author Information 52 | 53 | Allen Robel (@packetcalc) 54 | -------------------------------------------------------------------------------- /roles/ndfc_device_list_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_list_get 2 | 3 | Retrieve device configuration from the local inventory for all devices in fabric ``fabric_name`` 4 | 5 | ## Returns 6 | 7 | A JSON list of objects containing device configurations, including seed_ip, role, password, username. 8 | 9 | ### Example structure of returned information 10 | 11 | ```json 12 | [ 13 | { 14 | "seed_ip": "10.1.1.1", 15 | "role": "leaf", 16 | "password": "mypassword", 17 | "username": "admin" 18 | }, 19 | { 20 | "seed_ip": "10.1.1.2", 21 | "role": "spine", 22 | "password": "mypassword", 23 | "username": "admin" 24 | } 25 | ] 26 | ``` 27 | 28 | ## Role Variables 29 | 30 | Variable | Type | Description 31 | ----------------|--------|---------------------------------------- 32 | fabric_name | string | The fabric in which devices reside 33 | 34 | Device parameters are defined in the following file: 35 | 36 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 37 | 38 | See the following for details: 39 | 40 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 41 | 42 | ## Example Playbook 43 | 44 | ```yaml 45 | --- 46 | - hosts: ndfc 47 | gather_facts: false 48 | roles: 49 | - ndfc_device_list_get 50 | vars: 51 | fabric_name: f1 52 | tasks: 53 | - block: 54 | - debug: 55 | var: device_list 56 | when: "device_list != ''" 57 | ``` 58 | 59 | ## Licensing 60 | 61 | GNU General Public License v3.0 or later. 62 | 63 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 64 | 65 | ## Author Information 66 | 67 | Allen Robel (@packetcalc) 68 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_create_easy_fabric_f1.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_create_easy_fabric_f1.yml 2 | # This creates a standalone fabric (i.e. not MSD child). 3 | --- 4 | # Fabric and devices 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_rest_fabric_create_easy_fabric 9 | vars: 10 | fabric_name: f1 11 | 12 | # Fabric f1 - Add devices 13 | - hosts: ndfc 14 | gather_facts: false 15 | roles: 16 | - ndfc_device_list_get 17 | vars: 18 | fabric_name: f1 19 | 20 | - hosts: ndfc 21 | gather_facts: false 22 | roles: 23 | - ndfc_device_list_merged 24 | vars: 25 | devices: "{{ device_list }}" 26 | fabric_name: f1 27 | 28 | # vpc_1 29 | - hosts: ndfc 30 | gather_facts: false 31 | roles: 32 | - ndfc_rest_vpc_create 33 | vars: 34 | vpc_name: vpc_1 35 | 36 | - hosts: ndfc 37 | gather_facts: false 38 | roles: 39 | - ndfc_vpc_interface_merged_all 40 | vars: 41 | vpc_name: vpc_1 42 | 43 | # vpc_2 44 | - hosts: ndfc 45 | gather_facts: false 46 | roles: 47 | - ndfc_rest_vpc_create 48 | vars: 49 | vpc_name: vpc_2 50 | 51 | - hosts: ndfc 52 | gather_facts: false 53 | roles: 54 | - ndfc_vpc_interface_merged_all 55 | vars: 56 | vpc_name: vpc_2 57 | 58 | # VRFs 59 | - hosts: ndfc 60 | gather_facts: false 61 | roles: 62 | - ndfc_vrf_all 63 | vars: 64 | fabric_name: f1 65 | state: replaced 66 | 67 | # Networks 68 | - hosts: ndfc 69 | gather_facts: false 70 | roles: 71 | - ndfc_network_replaced_all 72 | vars: 73 | fabric_name: f1 74 | 75 | # Deploy 76 | - hosts: ndfc 77 | gather_facts: false 78 | roles: 79 | - ndfc_rest_config_deploy_all 80 | vars: 81 | fabric_name: f1 82 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_create_easy_fabric_f2.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_create_easy_fabric_f2.yml 2 | # This creates a standalone fabric (i.e. not MSD child). 3 | --- 4 | # Fabric and devices 5 | - hosts: ndfc 6 | gather_facts: false 7 | roles: 8 | - ndfc_rest_fabric_create_easy_fabric 9 | vars: 10 | fabric_name: f2 11 | 12 | # Fabric f2 - Add devices 13 | - hosts: ndfc 14 | gather_facts: false 15 | roles: 16 | - ndfc_device_list_get 17 | vars: 18 | fabric_name: f2 19 | 20 | - hosts: ndfc 21 | gather_facts: false 22 | roles: 23 | - ndfc_device_list_merged 24 | vars: 25 | devices: "{{ device_list }}" 26 | fabric_name: f2 27 | 28 | # vpc_3 29 | - hosts: ndfc 30 | gather_facts: false 31 | roles: 32 | - ndfc_rest_vpc_create 33 | vars: 34 | vpc_name: vpc_3 35 | 36 | - hosts: ndfc 37 | gather_facts: false 38 | roles: 39 | - ndfc_vpc_interface_merged_all 40 | vars: 41 | vpc_name: vpc_3 42 | 43 | # vpc_4 44 | - hosts: ndfc 45 | gather_facts: false 46 | roles: 47 | - ndfc_rest_vpc_create 48 | vars: 49 | vpc_name: vpc_4 50 | 51 | - hosts: ndfc 52 | gather_facts: false 53 | roles: 54 | - ndfc_vpc_interface_merged_all 55 | vars: 56 | vpc_name: vpc_4 57 | 58 | # VRFs 59 | - hosts: ndfc 60 | gather_facts: false 61 | roles: 62 | - ndfc_vrf_all 63 | vars: 64 | fabric_name: f2 65 | state: replaced 66 | 67 | # Networks 68 | - hosts: ndfc 69 | gather_facts: false 70 | roles: 71 | - ndfc_network_replaced_all 72 | vars: 73 | fabric_name: f2 74 | 75 | # Deploy 76 | - hosts: ndfc 77 | gather_facts: false 78 | roles: 79 | - ndfc_rest_config_deploy_all 80 | vars: 81 | fabric_name: f2 82 | -------------------------------------------------------------------------------- /example_ndfc_rest_fabric_delete_msd.yml: -------------------------------------------------------------------------------- 1 | # example_ndfc_rest_fabric_delete_msd.yml 2 | # 3 | # This playbook deletes the topology created with 4 | # example_ndfc_rest_fabric_create_msd_with_children.yml 5 | --- 6 | # Delete all networks 7 | - hosts: ndfc 8 | gather_facts: false 9 | roles: 10 | - ndfc_network_deleted_all 11 | vars: 12 | fabric_name: MSD 13 | 14 | # Delete all VRFs 15 | - hosts: ndfc 16 | gather_facts: false 17 | roles: 18 | - ndfc_vrf_all 19 | vars: 20 | fabric_name: MSD 21 | state: deleted 22 | 23 | # Remove fabric f1 from MSD fabric 24 | - hosts: ndfc 25 | gather_facts: false 26 | roles: 27 | - ndfc_rest_fabric_msd_child_remove 28 | vars: 29 | msd_fabric: MSD 30 | child_fabric: f1 31 | 32 | # Remove fabric f2 from MSD fabric 33 | - hosts: ndfc 34 | gather_facts: false 35 | roles: 36 | - ndfc_rest_fabric_msd_child_remove 37 | vars: 38 | msd_fabric: MSD 39 | child_fabric: f2 40 | 41 | # Delete switches from fabric f1 42 | - hosts: ndfc 43 | gather_facts: false 44 | roles: 45 | - ndfc_device_deleted_all 46 | vars: 47 | fabric_name: f1 48 | 49 | # Delete switches from fabric f2 50 | - hosts: ndfc 51 | gather_facts: false 52 | roles: 53 | - ndfc_device_deleted_all 54 | vars: 55 | fabric_name: f2 56 | 57 | # Delete fabric MSD 58 | - hosts: ndfc 59 | gather_facts: false 60 | roles: 61 | - ndfc_rest_fabric_delete 62 | vars: 63 | fabric_name: MSD 64 | 65 | # Delete fabric f1 66 | - hosts: ndfc 67 | gather_facts: false 68 | roles: 69 | - ndfc_rest_fabric_delete 70 | vars: 71 | fabric_name: f1 72 | 73 | # Delete fabric f2 74 | - hosts: ndfc 75 | gather_facts: false 76 | roles: 77 | - ndfc_rest_fabric_delete 78 | vars: 79 | fabric_name: f2 80 | -------------------------------------------------------------------------------- /roles/ndfc_device_ipv4_address_remote_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_ipv4_address_remote_get 2 | 3 | Query the NDFC controller for device's ipv4 address, given ``device_name``. 4 | 5 | The device's ipv4 address is returned in the variable ``device_ipv4_address``. 6 | 7 | ``device_ipv4_address`` is gleaned from the device itself. 8 | 9 | Since this operation involves a query of the NDFC controller, the result is returned slower than ``ndfc_device_ipv4_address_local_get`` 10 | 11 | SEE ALSO: ``ndfc_device_ipv4_address_local_get`` 12 | 13 | ## Role Variables 14 | 15 | Variable | Type | Description 16 | ----------------|--------|---------------------------------------- 17 | device_name | string | The device to be queried 18 | 19 | Fabric and device parameters are defined in the following files: 20 | 21 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 22 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 23 | 24 | See the following for details: 25 | 26 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 27 | 28 | ## Example Playbook 29 | 30 | ```yaml 31 | # Query NX-OS switch associated with fabric_name + device_name 32 | # and print device's ipv4 address 33 | --- 34 | - hosts: ndfc 35 | gather_facts: false 36 | roles: 37 | - ndfc_device_ipv4_address_remote_get 38 | vars: 39 | device_name: leaf_1 40 | tasks: 41 | - block: 42 | - debug: 43 | msg: "device_ipv4_address: {{ device_ipv4_address }}" 44 | when: "device_ipv4_address != ''" 45 | ``` 46 | 47 | ## Licensing 48 | 49 | GNU General Public License v3.0 or later. 50 | 51 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 52 | 53 | ## Author Information 54 | 55 | Allen Robel (@packetcalc) 56 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_no_shutdown/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_interface_no_shutdown 2 | 3 | Administratively ``no shutdown`` interface ``interface_name`` on ``device_name``. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|-------|------------------------------------------------ 9 | device_name | string | The device on which ``interface_name`` resides 10 | interface_name | string | The interface on ``device_name`` to no shutdown 11 | 12 | Device and interface parameters are defined in the following files: 13 | 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 20 | 21 | Other variables used in this Role: 22 | 23 | - [./roles/ndfc_rest_interface_no_shutdown/defaults/main.yml](/roles/ndfc_rest_interface_no_shutdown/defaults/main.yml) 24 | 25 | Variable | Type | Description 26 | -------------------|---------|------------ 27 | forceShowRun | boolean | Default: ``false`` Included in the config-deploy REST call payload. 28 | inclAllMSDSwitches | boolean | Default: ``false`` Included in the config-deploy REST call payload. 29 | 30 | ## Dependencies 31 | 32 | ## Example Playbooks 33 | 34 | ```yaml 35 | --- 36 | - hosts: ndfc 37 | gather_facts: false 38 | roles: 39 | - ndfc_rest_interface_no_shutdown 40 | vars: 41 | device_name: spine_1 42 | interface_name: Ethernet1/32 43 | ``` 44 | 45 | ## Licensing 46 | 47 | GNU General Public License v3.0 or later. 48 | 49 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 50 | 51 | ## Author Information 52 | 53 | Allen Robel (@packetcalc) 54 | -------------------------------------------------------------------------------- /roles/ndfc_rest_interface_shutdown/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_interface_shutdown 2 | 3 | Administratively shutdown interface ``interface_name`` on ``device_name``. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|------------------------------------------------ 9 | device_name | string | The device on which ``interface_name`` resides 10 | interface_name | string | The interface on ``device_name`` to shutdown 11 | 12 | Device and interface parameters are defined in the following files: 13 | 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | - [./inventory/group_vars/ndfc/03_networks.yml](/inventory/group_vars/ndfc/03_networks.yml) 16 | 17 | See the following for details: 18 | 19 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 20 | 21 | Other variables used in this Role: 22 | 23 | From [./roles/ndfc_rest_interface_shutdown/defaults/main.yml](/roles/ndfc_rest_interface_shutdown/defaults/main.yml) 24 | 25 | Variable | Type | Description 26 | -------------------|--------|------------ 27 | forceShowRun | bool() | Default: ``false`` Included in the config-deploy REST call payload. 28 | inclAllMSDSwitches | bool() | Default: ``false`` Included in the config-deploy REST call payload. 29 | 30 | ## Dependencies 31 | 32 | ## Example Playbooks 33 | 34 | ```yaml 35 | # example_ndfc_rest_interface_shutdown.yml 36 | --- 37 | - hosts: ndfc 38 | gather_facts: false 39 | roles: 40 | - ndfc_rest_interface_shutdown 41 | vars: 42 | device_name: spine_1 43 | interface_name: Ethernet1/32 44 | ``` 45 | 46 | ## Licensing 47 | 48 | GNU General Public License v3.0 or later. 49 | 50 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 51 | 52 | ## Author Information 53 | 54 | Allen Robel (@packetcalc) 55 | -------------------------------------------------------------------------------- /roles/ndfc_rest_device_list_by_fabric/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_rest_device_list_by_fabric 2 | 3 | Retrieve list of devices in fabric ``fabric_name`` 4 | 5 | Returns JSON object ``switch_list`` which will be a list of switch dictionaries 6 | if the GET request succeeded, or an empty list if the GET request failed. 7 | 8 | ## Role Variables 9 | 10 | Variable | Type | Description 11 | ----------------|--------|---------------------------------------- 12 | fabric_name | string | The fabric to be queried 13 | 14 | Fabric and device parameters are defined in the following files: 15 | 16 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 17 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 18 | 19 | See the following for details: 20 | 21 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 22 | 23 | ## Example Playbook 24 | 25 | The playbook below prints select information for every switch in fabric f2. 26 | 27 | ```yaml 28 | --- 29 | - hosts: ndfc 30 | gather_facts: false 31 | roles: 32 | - ndfc_rest_device_list_by_fabric 33 | vars: 34 | fabric_name: f2 35 | tasks: 36 | - debug: 37 | msg: "ipAddress: {{ item.ipAddress }} logicalName: {{ item.logicalName }} model {{ item.model }} release {{ item.release }} serialNumber {{ item.serialNumber }}" 38 | loop: "{{ switch_list | json_query(q1) }}" 39 | vars: 40 | q1: "[*].{ ipAddress: ipAddress, model: model, release: release, logicalName: logicalName serialNumber: serialNumber }" 41 | loop_control: 42 | label: device_info 43 | ``` 44 | 45 | ## Licensing 46 | 47 | GNU General Public License v3.0 or later. 48 | 49 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 50 | 51 | ## Author Information 52 | 53 | Allen Robel (@packetcalc) 54 | -------------------------------------------------------------------------------- /roles/ndfc_device_ipv4_address_local_get/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_ipv4_address_local_get 2 | 3 | Return device's ipv4 address from the local Ansible inventory, given ``device_name``. 4 | 5 | The device's ipv4 address is returned in the variable ``device_ipv4_address``. 6 | 7 | ``device_ipv4_address`` is gleaned locally from [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml). 8 | 9 | Since this operation is local, the result is returned faster than ``ndfc_device_ipv4_address_remote_get`` 10 | 11 | SEE ALSO: ``ndfc_device_ipv4_address_remote_get`` 12 | 13 | ## Role Variables 14 | 15 | Variable | Type | Description 16 | ----------------|--------|---------------------------------------- 17 | device_name | string | The device to be queried 18 | 19 | Fabric and device parameters are defined in the following files: 20 | 21 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 22 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 23 | 24 | See the following for details: 25 | 26 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 27 | 28 | ## Example Playbook 29 | 30 | ```yaml 31 | # Query ./inventory/group_vars/ndfc/02_devices.yml for fabric_name + device_name 32 | # and print the device's ipv4 address 33 | --- 34 | - hosts: ndfc 35 | gather_facts: false 36 | roles: 37 | - ndfc_device_ipv4_address_local_get 38 | vars: 39 | device_name: leaf_1 40 | tasks: 41 | - block: 42 | - debug: 43 | msg: "device_ipv4_address: {{ device_ipv4_address }}" 44 | when: "device_ipv4_address != ''" 45 | ``` 46 | 47 | ## Licensing 48 | 49 | GNU General Public License v3.0 or later. 50 | 51 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 52 | 53 | ## Author Information 54 | 55 | Allen Robel (@packetcalc) 56 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_merged/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_service_node_merged 2 | 3 | Create service node ``service_node_name`` using ansible merge operation 4 | 5 | NOTE 1: The ansible module ``cisco.dcnm.dcnm_service_node`` does not provide control over the attach interface's configuration, and a few other parameters. If you require these, see ``ndfc_rest_service_node_add`` instead. 6 | 7 | NOTE 2: ``service_node_type`` values are different between Ansible module dcnm_service_node and the REST API ``/appcenter/cisco/ndfc/api/v1/elastic-service/fabrics/{fabric-name}/service-nodes`` 8 | 9 | Since ndfc-roles offers roles based on both, you need to ensure that you're using the correct ``service_node_type`` values in [./inventory/group_vars/ndfc/06_service_nodes.yml](/inventory/group_vars/ndfc/06_service_nodes.yml), per below (these are case-sensitive): 10 | 11 | Role | service_node_type 12 | ----------------------------|---------------------------------------- 13 | ndfc_rest_service_node_add | Firewall, ADC, VNF 14 | ndfc_service_node_merged | firewall, load_balancer, virtual_network_function 15 | 16 | ## Role Variables 17 | 18 | Variable | Type | Description 19 | ------------------|--------|---------------------------------------- 20 | service_node_name | string | The service node to merge 21 | 22 | Service node parameters are defined in the following file: 23 | 24 | - [./inventory/group_vars/ndfc/06_service_nodes.yml](/inventory/group_vars/ndfc/06_service_nodes.yml) 25 | 26 | See the following for details: 27 | 28 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 29 | 30 | ## Example Playbook 31 | 32 | ```yaml 33 | --- 34 | - hosts: ndfc 35 | gather_facts: false 36 | roles: 37 | - ndfc_service_node_merged 38 | vars: 39 | service_node_name: sn_1 40 | ``` 41 | 42 | ## Licensing 43 | 44 | GNU General Public License v3.0 or later. 45 | 46 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 47 | 48 | ## Author Information 49 | 50 | Allen Robel (@packetcalc) 51 | -------------------------------------------------------------------------------- /roles/ndfc_rest_vpc_delete/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_vpc_delete/tasks/main.yml 2 | 3 | # REST returns internal server error (500) when called from 4 | # Ansible dcnm_rest module per below. Hence, this is a work in progress 5 | # and doesn't work. 6 | 7 | - ansible.builtin.include_role: 8 | name: ndfc_vpc_config_get 9 | 10 | # Retrieve serial number and vpc config state for vpc_peer_1 11 | 12 | - ansible.builtin.include_role: 13 | name: ndfc_device_config_get 14 | vars: 15 | device_name: "{{ vpc_config.peer_1 }}" 16 | 17 | - ansible.builtin.include_role: 18 | name: ndfc_device_info_get 19 | vars: 20 | device_name: "{{ vpc_config.peer_1 }}" 21 | 22 | - name: worker set_fact vpc_peer_1 fabric {{ device_config.switch_fabric }} vpc {{ vpc_name }} device {{ vpc_config.peer_1 }} - p1_serial, p1_vpc 23 | set_fact: 24 | p1_serial: "{{ device_info.serialNumber }}" 25 | p1_vpc: "{{ device_info.isVpcConfigured }}" 26 | 27 | # Retrieve serial number and vpc config state for vpc_peer_2 28 | 29 | - ansible.builtin.include_role: 30 | name: ndfc_device_config_get 31 | vars: 32 | device_name: "{{ vpc_config.peer_2 }}" 33 | 34 | - ansible.builtin.include_role: 35 | name: ndfc_device_info_get 36 | vars: 37 | device_name: "{{ vpc_config.peer_2 }}" 38 | 39 | - name: worker set_fact vpc_peer_2 fabric {{ device_config.switch_fabric }} vpc {{ vpc_name }} device {{ vpc_config.peer_2 }} - p2_serial, p2_vpc 40 | set_fact: 41 | p2_serial: "{{ device_info.serialNumber }}" 42 | p2_vpc: "{{ device_info.isVpcConfigured }}" 43 | 44 | # Conditionally delete vpc peering 45 | - name: main REST DELETE VPC Peers fabric_name {{ fabric_name }} vpc_name {{ vpc_name }} configured {{ p1_vpc }}/{{ p2_vpc }} serial_numbers {{ p1_serial }}/{{ p2_serial }}" 46 | cisco.dcnm.dcnm_rest: 47 | method: DELETE 48 | path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair" 49 | json_data: "{{ vars_dict | to_json }}" 50 | vars: 51 | vars_dict: 52 | serialNumber: "{{ p2_serial }}" 53 | when: p1_serial != '' and p2_serial != '' and p1_vpc == True and p2_vpc == True 54 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged_all/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_merged_all 2 | 3 | Merge all leaf, spine, border_gateway devices into fabric ``fabric_name``. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | fabric_name | string | The fabric in which the devices reside 10 | 11 | Fabric and device parameters are defined in the following files: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | Other variables used in this Role: 21 | 22 | - [./roles/ndfc_device_merged_all/defaults/main.yml](/roles/ndfc_device_merged_all/defaults/main.yml) 23 | 24 | Variable | Type | Description 25 | ----------------|---------|------------ 26 | auth_proto | string | the protocol to use to authenticate to each device. We assume all devices use the same protocol 27 | max_hops | integer | the number of CDP hops to traverse when discovering devices. We set this to 0 to discover one device at a time 28 | preserve_config | boolean | If true, preserve the existing config on the device(s). If false, do not preserve the configs. 29 | 30 | - [./inventory/group_vars/ndfc/00_connection.yml](/inventory/group_vars/ndfc/00_connection.yml) 31 | 32 | Variable | Type | Description 33 | ----------------------|---------|------------ 34 | device_password | string | The password used to login to the device 35 | device_username | string | The username used to login to the device 36 | 37 | ## Dependencies 38 | 39 | ## Example Playbook 40 | 41 | ```yaml 42 | --- 43 | - hosts: ndfc 44 | gather_facts: false 45 | roles: 46 | - ndfc_device_merged_all 47 | vars: 48 | fabric_name: f1 49 | ``` 50 | 51 | ## Licensing 52 | 53 | GNU General Public License v3.0 or later. 54 | 55 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 56 | 57 | ## Author Information 58 | 59 | Allen Robel (@packetcalc) 60 | -------------------------------------------------------------------------------- /roles/ndfc_policy_vrf_rt_import_evpn/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_policy_vrf_rt_import_evpn 2 | 3 | Import vrf ``import_vrf_name``'s route-targets into vrf ``vrf_name`` on device ``device_name`` using Ansible state ``state`` 4 | 5 | NOTE: This role isn't needed when route-target imports are added to a VRF's config. See the following. 6 | 7 | - [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 8 | - [./inventory/group_vars/ndfc/04_vrfs.yml](/inventory/group_vars/ndfc/04_vrfs.yml) 9 | 10 | ## Role Variables 11 | 12 | Variable | Type | Description 13 | ----------------|--------|---------------------------------------- 14 | fabric_name | string | The fabric in which ``device_name`` resides 15 | device_name | string | The device to which vrf ``vrf_name`` is attached 16 | vrf_name | string | The vrf into which ``import_vrf_name``'s route-targets will be imports 17 | import_vrf_name | string | The vrf whose route-targets will be imported into ``vrf_name`` 18 | state | string | The Ansible state to apply for the import. e.g. ``deleted`` to delete the import, ``merged`` to merge the import. NOTE: ``replaced`` is not a valid state for this module. 19 | 20 | Fabric, device and VRF parameters are defined in the following files: 21 | 22 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 23 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 24 | - [./inventory/group_vars/ndfc/04_vrfs.yml](/inventory/group_vars/ndfc/04_vrfs.yml) 25 | 26 | See the following for details: 27 | 28 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 29 | 30 | ## Example Playbook 31 | 32 | ```yaml 33 | # Import vrf v2's route-targets into vrf v1 on device leaf_2 in fabric f1, using Ansible state 'merged' 34 | --- 35 | - hosts: ndfc 36 | gather_facts: false 37 | roles: 38 | - ndfc_policy_vrf_rt_import_evpn 39 | vars: 40 | fabric_name: f1 41 | device_name: leaf_2 42 | vrf_name: v1 43 | import_vrf_name: v2 44 | state: merged 45 | ``` 46 | 47 | ## Licensing 48 | 49 | GNU General Public License v3.0 or later. 50 | 51 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 52 | 53 | ## Author Information 54 | 55 | Allen Robel (@packetcalc) 56 | -------------------------------------------------------------------------------- /roles/ndfc_device_merged/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_device_merged 2 | 3 | Merge device ``device_name`` into the topology. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | device_name | string | The device to be merged 10 | 11 | Fabric and device parameters are defined in the following files: 12 | 13 | - [./inventory/group_vars/ndfc/01_fabrics.yml](/inventory/group_vars/ndfc/01_fabrics.yml) 14 | - [./inventory/group_vars/ndfc/02_devices.yml](/inventory/group_vars/ndfc/02_devices.yml) 15 | 16 | See the following for details: 17 | 18 | [./inventory/group_vars/README.md](/inventory/group_vars/README.md) 19 | 20 | Other variables used in this Role: 21 | 22 | - [./roles/ndfc_devices_merged/defaults/main.yml](/roles/ndfc_devices_merged/defaults/main.yml) 23 | 24 | Variable | Type | Description 25 | -------------------|------------|------------ 26 | auth_proto | string | The protocol to use to authenticate to each device. We assume all devices use the same protocol. 27 | max_hops | integer | The number of CDP hops to traverse when discovering devices. We set this to 0 to discover one device at a time. 28 | preserve_config | boolean | If true, preserve the existing config on the device(s). If false, do not preserve the configs. 29 | forceShowRun | boolean | Default: ``false`` Included in the config-deploy REST call payload. 30 | inclAllMSDSwitches | boolean | Default: ``false`` Included in the config-deploy REST call payload. 31 | 32 | - [./inventory/group_vars/ndfc/00_connection.yml](/inventory/group_vars/ndfc/00_connection.yml) 33 | 34 | Variable | Type | Description 35 | ----------------------|---------|------------ 36 | device_password | string | The password used to login to the device 37 | device_username | string | The username used to login to the device 38 | 39 | ## Dependencies 40 | 41 | ## Example Playbooks 42 | 43 | ```yaml 44 | --- 45 | - hosts: ndfc 46 | gather_facts: false 47 | roles: 48 | - ndfc_device_merged 49 | vars: 50 | device_name: spine_1 51 | ``` 52 | 53 | ## Licensing 54 | 55 | GNU General Public License v3.0 or later. 56 | 57 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 58 | 59 | ## Author Information 60 | 61 | Allen Robel (@packetcalc) 62 | -------------------------------------------------------------------------------- /roles/ndfc_vrf_query/README.md: -------------------------------------------------------------------------------- 1 | # ndfc_vrf_query 2 | 3 | Query VRF ``vrf_name`` and return json object ``vrf_info`` which contains vrf information for ``vrf_name`` from the NDFC controller. 4 | 5 | ## Role Variables 6 | 7 | Variable | Type | Description 8 | ----------------|--------|---------------------------------------- 9 | vrf_name | string | The vrf to query. 10 | 11 | VRF parameters are defined in the following files: 12 | 13 | [./inventory/group_vars/ndfc/04_vrfs.yml](/inventory/group_vars/ndfc/04_vrfs.yml) 14 | 15 | NOTE, ``vrf_name`` above corresponds to the ``name:`` key within the vrfs dictionary in the file noted above. The ``name:`` key is unique across all defined vrfs, whereas the ``vrf_name:`` key is not unique and cannot be used with this role. By way of example, in the entry below, you would use the value of ``name:`` rather than the value of ``vrf_name``. The example playbook below shows the correct value to use. 16 | 17 | ## Example entry in the vrfs dictionary 18 | 19 | ```yaml 20 | f2_v1: 21 | name: f2_v1 22 | fabric: "{{ switch_fabrics.f2.name }}" 23 | vrf_name: v1 24 | vrf_id: 63031 25 | vlan_id: 3031 26 | vrf_template: Default_VRF_Universal 27 | vrf_extension_template: Default_VRF_Extension_Universal 28 | service_vrf_template: null 29 | attach: 30 | - ip_address: "{{ devices.leaf_5.ip }}" 31 | - ip_address: "{{ devices.leaf_6.ip }}" 32 | - ip_address: "{{ devices.leaf_7.ip }}" 33 | - ip_address: "{{ devices.leaf_8.ip }}" 34 | ``` 35 | 36 | ### Example playbook to query the above vrf 37 | 38 | ```yaml 39 | --- 40 | - hosts: ndfc 41 | gather_facts: false 42 | roles: 43 | - ndfc_vrf_query 44 | vars: 45 | vrf_name: f2_v1 46 | tasks: 47 | - debug: 48 | msg: "vrf_info.parent.fabric: {{ vrf_info.parent.fabric }}" 49 | - debug: 50 | msg: "vrf_info.parent.vrfId: {{ vrf_info.parent.vrfId }}" 51 | - debug: 52 | msg: "vrf_info.parent.vrfStatus: {{ vrf_info.parent.vrfStatus }}" 53 | ``` 54 | 55 | See the following for details: 56 | 57 | [./inventory/group_vars/README.md](https://github.com/allenrobel/ndfc-roles/tree/master/inventory/group_vars/README.md) 58 | 59 | ## Licensing 60 | 61 | GNU General Public License v3.0 or later. 62 | 63 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) for full text. 64 | 65 | ## Author Information 66 | 67 | Allen Robel (@packetcalc) 68 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_deleted/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_service_node_deleted/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: worker set_fact service_node {{ service_node_name }} 7 | set_fact: 8 | external_fabric_name: "{{ service_nodes.values() | list | json_query(mq2) }}" 9 | service_node_type: "{{ service_nodes.values() | list | json_query(mq3) }}" 10 | service_node_form_factor: "{{ service_nodes.values() | list | json_query(mq4) }}" 11 | service_node_interface_name: "{{ service_nodes.values() | list | json_query(mq6) }}" 12 | attached_fabric_name: "{{ service_nodes.values() | list | json_query(mq7) }}" 13 | attached_switch_name: "{{ service_nodes.values() | list | json_query(mq8) }}" 14 | attached_switch_interface_name: "{{ service_nodes.values() | list | json_query(mq9) }}" 15 | vars: 16 | mq2: "[?service_node_name == '{{ service_node_name }}'].external_fabric_name | [0]" 17 | mq3: "[?service_node_name == '{{ service_node_name }}'].service_node_type | [0]" 18 | mq4: "[?service_node_name == '{{ service_node_name }}'].service_node_form_factor | [0]" 19 | mq6: "[?service_node_name == '{{ service_node_name }}'].service_node_interface_name | [0]" 20 | mq7: "[?service_node_name == '{{ service_node_name }}'].attached_fabric_name | [0]" 21 | mq8: "[?service_node_name == '{{ service_node_name }}'].attached_switch_name | [0]" 22 | mq9: "[?service_node_name == '{{ service_node_name }}'].attached_switch_interface_name | [0]" 23 | 24 | - ansible.builtin.include_role: 25 | name: ndfc_device_ipv4_address_local_get 26 | vars: 27 | device_name: "{{ attached_switch_name }}" 28 | 29 | - name: main service_node_deleted attached_fabric_name {{ attached_fabric_name }} service_node {{ service_node_name }} type {{ service_node_type | lower }} form_factor {{ service_node_form_factor | lower }} ipv4 {{ device_ipv4_address }} 30 | cisco.dcnm.dcnm_service_node: 31 | fabric: "{{ attached_fabric_name }}" 32 | service_fabric: "{{ external_fabric_name }}" 33 | state: deleted 34 | config: 35 | - name: "{{ service_node_name }}" 36 | type: "{{ service_node_type }}" 37 | form_factor: "{{ service_node_form_factor | lower }}" 38 | svc_int_name: "{{ service_node_interface_name }}" 39 | attach_interface: "{{ attached_switch_interface_name }}" 40 | switches: 41 | - "{{ device_ipv4_address }}" 42 | vars: 43 | ansible_connection: httpapi 44 | -------------------------------------------------------------------------------- /roles/ndfc_service_node_merged/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # ndfc_rest_service_node_merged/tasks/main.yml 2 | --- 3 | - ansible.builtin.include_role: 4 | name: ndfc_rest_fabric_active_fabrics_get 5 | 6 | - name: worker set_fact service_node {{ service_node_name }} 7 | set_fact: 8 | external_fabric_name: "{{ service_nodes.values() | list | json_query(mq2) }}" 9 | service_node_type: "{{ service_nodes.values() | list | json_query(mq3) }}" 10 | service_node_form_factor: "{{ service_nodes.values() | list | json_query(mq4) }}" 11 | service_node_interface_name: "{{ service_nodes.values() | list | json_query(mq6) }}" 12 | attached_fabric_name: "{{ service_nodes.values() | list | json_query(mq7) }}" 13 | attached_switch_name: "{{ service_nodes.values() | list | json_query(mq8) }}" 14 | attached_switch_interface_name: "{{ service_nodes.values() | list | json_query(mq9) }}" 15 | vars: 16 | mq2: "[?service_node_name == '{{ service_node_name }}'].external_fabric_name | [0]" 17 | mq3: "[?service_node_name == '{{ service_node_name }}'].service_node_type | [0]" 18 | mq4: "[?service_node_name == '{{ service_node_name }}'].service_node_form_factor | [0]" 19 | mq6: "[?service_node_name == '{{ service_node_name }}'].service_node_interface_name | [0]" 20 | mq7: "[?service_node_name == '{{ service_node_name }}'].attached_fabric_name | [0]" 21 | mq8: "[?service_node_name == '{{ service_node_name }}'].attached_switch_name | [0]" 22 | mq9: "[?service_node_name == '{{ service_node_name }}'].attached_switch_interface_name | [0]" 23 | 24 | - ansible.builtin.include_role: 25 | name: ndfc_device_ipv4_address_local_get 26 | vars: 27 | device_name: "{{ attached_switch_name }}" 28 | 29 | - name: main service_node_merged attached_fabric_name {{ attached_fabric_name }} service_node {{ service_node_name }} type {{ service_node_type | lower }} form_factor {{ service_node_form_factor | lower }} ipv4 {{ device_ipv4_address }} 30 | cisco.dcnm.dcnm_service_node: 31 | fabric: "{{ attached_fabric_name }}" 32 | service_fabric: "{{ external_fabric_name }}" 33 | state: merged 34 | config: 35 | - name: "{{ service_node_name }}" 36 | type: "{{ service_node_type }}" 37 | form_factor: "{{ service_node_form_factor | lower }}" 38 | svc_int_name: "{{ service_node_interface_name }}" 39 | attach_interface: "{{ attached_switch_interface_name }}" 40 | switches: 41 | - "{{ device_ipv4_address }}" 42 | vars: 43 | ansible_connection: httpapi 44 | --------------------------------------------------------------------------------