Before starting this lab, make sure you are on the stage branch
git branch --show-current
stage
Before starting this section, it might be helpful to close out your file tabs at the top of your VSCode editor from the previous lab task. This is certainly not mandatory but might keep the flow more organized and uncluttered.
All of our previous tasks have targeted the staging environment. In this section we need to define how Ansible will
reach the NDFC controller to manage the production environment
.
Now we need to define the same files but this time for the production environment.
hosts.prod.yml
- This file defines how Ansible will connect to the NDFC controller for the production
environment.group_vars/prod/fabric.yml
- This file defines the fabric configuration for the production environment.group_vars/prod/overlay.yml
- This file defines the overlay configuration for the production environment.Create the file and add content to the file using the following commands.
touch /home/cisco/CiscoLive/DEVWKS-3928/hosts.prod.yml
cat << EOF > /home/cisco/CiscoLive/DEVWKS-3928/hosts.prod.yml
---
# Connection Information For Production Fabric
#
# This file defines how Ansible will connect to the NDFC controller
ndfc:
children:
prod:
hosts:
10.15.0.98:
ansible_connection: ansible.netcommon.httpapi
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false
ansible_python_interpreter: auto_silent
ansible_network_os: cisco.dcnm.dcnm
ansible_user: admin
ansible_password: "{{ ndfc_password }}"
device_spine: 10.15.30.14
device_leaf1: 10.15.30.15
device_leaf2: 10.15.30.16
EOF
touch /home/cisco/CiscoLive/DEVWKS-3928/group_vars/prod/fabric.yml
cat << EOF > /home/cisco/CiscoLive/DEVWKS-3928/group_vars/prod/fabric.yml
---
fabric:
name: fabric-prod
asn: 65088
inventory:
- seed_ip: 10.15.30.14
auth_proto: MD5
user_name: admin
password: ""
max_hops: 0
role: spine
preserve_config: false
- seed_ip: 10.15.30.15
user_name: admin
password: ""
max_hops: 0
role: leaf
preserve_config: false
- seed_ip: 10.15.30.16
user_name: admin
password: ""
max_hops: 0
role: leaf
preserve_config: false
EOF
touch /home/cisco/CiscoLive/DEVWKS-3928/group_vars/prod/overlay.yml
cat << EOF > /home/cisco/CiscoLive/DEVWKS-3928/group_vars/prod/overlay.yml
---
vrf_attach_group:
all_leaf:
- ip_address: 10.15.30.15
- ip_address: 10.15.30.16
attach_group:
esxi:
- ip_address: 10.15.30.15
ports:
- Ethernet1/15
- ip_address: 10.15.30.16
ports:
- Ethernet1/15
EOF