For the overlay role tasks, ensure you are in your VSCode Terminal and open the main.yml file found in roles/manage_overlay/tasks/ using the VSCode code keyword as before.
It is finally time to add tasks to your deploy role. The tasks will be used to save the configuration and deploy the pending fabric configuration to your switches.
For these tasks, we leverage the generic fallback module cisco.dcnm.dcnm_rest
to interact with the NDFC REST API.
The first task is the API to save the configuration of the fabric, while the second is to trigger the deployment of the fabric configuration.
For these tasks, you may be introduced to the block
keyword. The block keyword is used to group tasks together.
These tasks are grouped and have a common tag of deploy
associated with them.
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.
build_fabric.yml
Ansible PlaybookNavigate back to your build_fabric.yml file by using the VSCode code command:
deploy
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_overlay
. Note: Make sure you identation is correct and aligns with the previous item which should
be - manage_interfaces
.
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 [WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/manage_overlay/tasks/resync_fabric.yml is empty and had no tasks to include [WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/manage_overlay/tasks/add_vrf_lite_vrfs.yml is empty and had no tasks to include [WARNING]: file /home/cisco/Documents/ndfclab/ansible/roles/manage_overlay/tasks/add_policies.yml is empty and had no tasks to include PLAY [Build VXLAN EVPN Fabric on NDFC] ******************************************************************************************************************************************************************** TASK [deploy : Config-Save for Fabric fabric-stage] ******************************************************************************************************************************************************* ok: [10.15.0.23] TASK [deploy : Deploy for Fabric fabric-stage] ************************************************************************************************************************************************************ ok: [10.15.0.23] PLAY RECAP ************************************************************************************************************************************************************************************************ 10.15.0.23 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Return to your NDFC browser window and verify the deployment of the fabric configuration.
In-Sync
. If not, please click the refresh button to the right of the Actions button
Next you will start to extend the existing roles and learn more about the Ansible NDFC collection.