Now we need to configure the Ansible inventory file to tell Ansible how to reach the NDFC controller for the Staging topology.
Apply the following command in your Visual Studio Code Terminal to create and modify the file.
touch /home/cisco/CiscoLive/DEVWKS-3928/hosts.stage.yml
cat << EOF > /home/cisco/CiscoLive/DEVWKS-3928/hosts.stage.yml
---
# Connection Information For Staging Fabric
#
# This file defines how Ansible will connect to the NDFC controller
ndfc:
children:
stage:
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.11
device_leaf1: 10.15.30.12
device_leaf2: 10.15.30.13
EOF
The variables above provide important information that tells Ansible how to connect and authenticate with the NDFC
controller. It also includes connection information for the devices in the fabric that it manages. Notice that the
ndfc_password
is passed in as a variable. In our lab, we are using Ansible vault
to encyrpt the password.