In this part of the lab you will add vPC interfaces on leaf1 and leaf2 and two host facing interfaces for server1 and server2
interfaces.yml
under group_vars/stage/
To manage the interfaces on the staging fabric, you will create a file that contains the interface variable data for vPC interfaces and access interfaces that you will provision to NDFC that will be configured on leaf1 and leaf2 when deployed.
stage
This data file is going back to stored in the group_vars/stage
directory as it is specific data configuration for your staging or test fabric.
When it comes time to deploy to production you will have a similar file in the group_vars/prod
directory.
manage_interfaces
RoleFor the manage_interfaces role tasks, ensure you are in your VSCode Terminal and open the main.yml file found in the roles/manage_interfaces/tasks directory using the VSCode code keyword as before.
Copy the below tasks into the roles/manage_interfaces/tasks/main.yml
file that uses various subtask imports for managing different types of interfaces in NDFC via Ansible.
After successfully populating the file above, save the file using Ctrl+s on the Windows keyboard or by clicking File then Save.
Be sure to save your file! Not saving will result in your code not executing.
host_interfaces.yml
Subtask File for Managing Host-Facing InterfacesThis file contains the subtasks used to configure host facing interfaces for the Linux servers connected to leaf1 and leaf2.
vpc_interfaces.yml
Subtask File for Managing vPC InterfacesThis file contains the subtasks used to configure a vPC interface on leaf1 and leaf2.
loopback_interfaces.yml
Just like the previous sections, you need to add an empty placeholder file for managing loopback interfaces that will be filled in with tasks later in this lab.
ansible.builtin.import_tasks: loopback_interfaces.yml
build_fabric.yml
Ansible PlaybookNavigate back to your build_fabric.yml file by using the VSCode code command:
manage_interfaces
role under the roles: section of the playbook
Your build_fabric.yml file should already be populated from the previous section. With the file open, you only need to add the highlighted line, which should be line number 13
in your file. You can do this by highlighting the text in the lab guide and copying then pasting in your file or typing the line in your file. After one of those actions, press the
return key such that there is a new line after where you entered - manage_interfaces
.
- setup_vpc
After successfully populating the file above, save the file using Ctrl+s on the Windows keyboard or by clicking File then Save.
Be sure to save your file! Not saving will result in your code not executing.
Make sure you are in the root Ansible directory
From the root ansible project directory execute the following command.
Upon a successful run of the playbook your output should look as follows:
[WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/create_fabric/tasks/manage_external_fabric.yml is empty and had no tasks to include [WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/add_inventory/tasks/add_fabric_devices_poap.yml is empty and had no tasks to include [WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/add_inventory/tasks/add_fabric_external_devices.yml is empty and had no tasks to include [WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/manage_interfaces/tasks/loopback_interfaces.yml is empty and had no tasks to include PLAY [Build VXLAN EVPN Fabric on NDFC] ******************************************************************************************************************************************************************** TASK [manage_interfaces : ansible.builtin.debug] ********************************************************************************************************************************************************** ok: [10.15.0.98] => { "msg": [ "----------------------------------------------------------------", "+ Calling Role - [manage_interfaces] +", "----------------------------------------------------------------" ] } TASK [manage_interfaces : Create Host Facing Access Interfaces On Leaf Switches] ************************************************************************************************************************** changed: [10.15.0.98] TASK [manage_interfaces : Create vPC Interfaces on Leaf Switches] ***************************************************************************************************************************************** changed: [10.15.0.98] PLAY RECAP ************************************************************************************************************************************************************************************************ 10.15.0.98 : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Return to your NDFC browser where you should be sitting on the Switches tab.
When reviewing the Interfaces tab, it is expected to see interfaces in various status since a deployment has not taken place yet.
Again, you will deploy to your switches in the deploy
role. Following the remaining steps to verify the interface configuration is pre-staged in NDFC.
enter
Make sure Interfaces vPC10 and vPC20 are created between staging-leaf1 and staging-leaf2 and they are NA under Sync Status. These will change to In-Sync after the deployment role is completed later in the lab.
Enter
Verify that the policy for interface Ethernet1/1 on leaf1 and leaf2 is set to int_access_host
On the keyword press Ctrl + K + W
. This should close all open tabs to clear your workspace for the next section.
Continue to the next section to build out the Ansible overlay role for configuring VRFs and networks on the staging fabric.