Task01
Design Main Playbook

Design Main Ansible Playbook

Check Branch

Before starting this task, make sure you are on the 'stage' branch


git branch --show-current


stage

Step 1 - Examine the top level build.yml playbook

Before we start building the fabric, we need a top level playbook that will call our Ansible role. The top level playbook is called build.yml. We will create the role and tasks in the next section.




This file has already been created for you and exists in your github repo.


---
# This is the top level build playbook that runs the various
# Ansible roles that will be used to build out the fabric
- name: Build VXLAN EVPN Fabric on NDFC
  hosts: ndfc
  gather_facts: false
  roles:
  - configure_overlay
  # - bonus_template_policy

A role called configure_overlay is called in the top level playbook. This role will be used to configure the overlay VRFs and Networks for our VXLAN EVPN Fabric.

Step 2 - Create playbook variables for the fabric

File fabric.yml under group_vars defines the fabric variables that will be used in later tasks.



Create file group_vars/stage/fabric.yml and add content to the file using the following commands.

Quick Tip

You can hover over the Visual Studio Code Terminal example below to make a Copy button appear on the right hand side. Go ahead and try it now. Then just click the Copy button to copy the command and paste it into the terminal to bring up the file in your VSCode editor to make changes to the file. This functionality will be available in many of the tasks throughout this lab.


touch /home/cisco/CiscoLive/DEVWKS-3928/group_vars/stage/fabric.yml
cat << EOF > /home/cisco/CiscoLive/DEVWKS-3928/group_vars/stage/fabric.yml
---
fabric:
  name: fabric-stage
  asn: 65088
  inventory:
    - seed_ip: 10.15.30.11
      auth_proto: MD5
      user_name: admin
      password: ""
      max_hops: 0
      role: spine
      preserve_config: false
    - seed_ip: 10.15.30.12
      user_name: admin
      password: ""
      max_hops: 0
      role: leaf
      preserve_config: false
    - seed_ip: 10.15.30.13
      user_name: admin
      password: ""
      max_hops: 0
      role: leaf
      preserve_config: false
EOF


We will be using the fabric.name variable from the file above in this lab. The other variables were used previously to create the initial state for this lab and are included here for your reference.

Notice that the name is fabric-stage. This will become important later in this lab.

  • Introduction
  • NDFC and Ansible
  • Lab Environment and Topology
  • Task01 Setup Ansible
  • Task02 Overlay Playbook
  • Task03 CI/CD Pipeline
  • Thanks
  • Bonus: Task04 Policy Playbook