Now that Ansible has been installed on your development server you will focus on creating the playbooks to build out an entire VXLAN EVPN Fabric using the Ansible NDFC collection. The following Ansible NDFC collection modules will be the focus of this lab.
Let's Get Started!
Create all of the Ansible roles that will be used to build the Fabric.
Roles let you automatically load related vars, files, tasks, handlers, and other Ansible artifacts based on a known file structure.
After you group your content in roles, you can easily reuse them and share them with other users.
Reference:
Ansible Roles Documentation
cd ~/workspace/ndfclab/ansible
ansible-galaxy init roles/create_fabric
You should see the following output:
- Role roles/create_fabric was created successfully
ansible-galaxy init roles/add_inventory
ansible-galaxy init roles/setup_vpc
ansible-galaxy init roles/manage_interfaces
ansible-galaxy init roles/manage_overlay
ansible-galaxy init roles/deploy
Right now these roles are just generally empty directory folders with some boiler plate context and files
but each have a specific purpose within the role. you will only focus on populating the main
tasks folder
in each role but here is a link to more
documentation about how roles are used and how each directory within a role can be used.
Reference:
Roles Directory Structure
You are only going to focus on the tasks directory in the role directory, roles/[role_name]/tasks
, in this lab so go ahead and remove the other folders.
find ~/workspace/ndfclab/ansible/roles/*/ 2>/dev/null -mindepth 1 -name tasks -prune -o -exec rm -rf {} \;
View the structure by issuing the tree
command on the roles
parent directory.
tree roles/
roles/ ├── add_inventory │ └── tasks │ └── main.yml ├── create_fabric │ └── tasks │ └── main.yml ├── deploy │ └── tasks │ └── main.yml ├── manage_interfaces │ └── tasks │ └── main.yml ├── manage_overlay │ └── tasks │ └── main.yml └── setup_vpc └── tasks └── main.yml 12 directories, 6 files
You should see 12 directories, 6 files
.
Move to the next section where you will define the variables used to connect and authenticate to NDFC and variables used in the roles you just created in this section.