This PoC uses five Dell PowerSwitches. You can specify variables specific to hosts such as hostname, IP, and connection in the inventory file or a separate folder. In our PoC, we created a separate directory host_vars to store the variable files. This section describes how to create the host_vars files.
Create the Leaf 1 variable file
To create the Leaf 1 variable file, perform the following steps:
- To create a host_vars directory inside the PoC directory, navigate to the PoC directory and type the following command in the terminal window:
root@AnsibleNode:~/POC# mkdir host_vars
- To create a file in the host_vars directory, open Vim and type the following command:
root@AnsibleNode:~/POC# leaf1.yaml
Vim creates the file and the file opens. - To enter Insert mode, type i. 'INSERT' displays at the bottom of the screen.
- Copy the following statements into the leaf1.yaml file:
hostname: leaf1 ansible_ssh_user: admin ansible_ssh_pass: admin ansible_network_os=dellemc.os10.os10 os10_system: hostname: "Leaf1" os10_interface: loopback 0: admin: up ip_and_mask: 10.1.1.1/32 loopback 1: admin: up ip_and_mask: 10.2.2.1/32 virtual-network 1002: vrf: "tenant1" admin: up ip_and_mask: "192.168.102.2/24" virtual_gateway_ip: "192.168.102.1" virtual-network 1008: vrf: "tenant1" admin: up ip_and_mask: "192.168.106.2/24" virtual_gateway_ip: "192.168.106.1" ethernet 1/1/1: desc: "link to H1" admin: up portmode: trunk ethernet 1/1/53: desc: "link to SPINE1" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/55: desc: "link to SPINE2" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/12: desc: "link to VLT Pair" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/13: desc: "link to VLT Pair" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 os10_vlan: vlan 200: tagged members: - port: port-channel 1 os10_lag: Po1: admin: up state: present type: dynamic channel_members: - port: ethernet 1/1/1 mode: “active” os10_vlt: domain: 1 discovery_intf: 1/1/12-1/1/13 discovery_intf_state: present peer_routing: True vlt_mac: aa:aa:aa:aa:aa:aa vlt_peers: Po 1: peer_lag: 1 State: present os10_vrf: vrfdetails: - vrf_name: "tenant1" state: "present" os10_bgp: asn: 65021 router_id: 10.2.2.1 ipv4_network: - address: 10.2.2.1/32 state: present neighbor: - type: ipv4 interface: ethernet1/1/53 send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present admin: up state: present - type: ipv4 interface: ethernet1/1/55 send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present admin: up state: present os10_vxlan: anycast_gateway_mac: "00:01:01:01:01:01" nve: source_interface: "0" state: "present" evpn: autoevi: True rmac: 00:00:01:02:03:04 vrf: - name: "TENANT1" vni: 3000 route_target: - type: "manual" asn_value: "3000:3000" route_target_type: "both" state: "present" virtual_network: virtual_net: - id: 1002 member_interface: - ifname: "ethernet 1/1/1" type: "tagged" vlanid: 102 state: "present" vxlan_vni: id: 1002 state: "present" state: "present" - id: 1008 member_interface: - ifname: "ethernet 1/1/1" type: "tagged" vlanid: 108 state: "present" vxlan_vni: id: 1008 state: "present" state: "present"
- Save and close the file:
- To exit Insert mode, press the Esc key.
- To save the file, type the following command:
: wq
- Press the Enter key.
Create the Leaf 2 variable file
To create the Leaf 2 variable file, perform the following steps:
- To create a file in the host_vars directory, open Vim and type the following command:
root@AnsibleNode:~/POC# host_vars/leaf2.yaml
Vim creates the file and the file opens. - To enter Insert mode, type i. 'INSERT' displays at the bottom of the screen.
- Copy the following statements into the leaf2.yaml file:
hostname: leaf2 ansible_ssh_user: admin ansible_ssh_pass: admin ansible_network_os=dellemc.os10.os10 os10_system: hostname: "Leaf2" os10_interface: loopback 0: admin: up ip_and_mask: 10.1.1.1/32 loopback 1: admin: up ip_and_mask: 10.2.2.2/32 virtual-network 1002: vrf: "tenant1" admin: up ip_and_mask: "192.168.102.2/24" virtual_gateway_ip: "192.168.102.1" virtual-network 1008: vrf: "tenant1" admin: up ip_and_mask: "192.168.106.2/24" virtual_gateway_ip: "192.168.106.1" ethernet 1/1/1: desc: "link to H1" admin: up portmode: trunk ethernet 1/1/53: desc: "link to SPINE1" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/55: desc: "link to SPINE2" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/12: desc: "link to VLT Pair" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/13: desc: "link to VLT Pair" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 os10_vlan: vlan 200: tagged members: - port: port-channel 1 os10_lag: Po1: admin: up state: present type: dynamic channel_members: - port: ethernet 1/1/1 mode: “active” os10_vlt: domain: 1 discovery_intf: 1/1/12-1/1/13 discovery_intf_state: present peer_routing: True vlt_mac: aa:aa:aa:aa:aa:aa vlt_peers: Po 1: peer_lag: 1 State: present os10_vrf: vrfdetails: - vrf_name: "tenant1" state: "present" os10_bgp: asn: 65021 router_id: 10.2.2.1 ipv4_network: - address: 10.2.2.1/32 state: present neighbor: - type: ipv4 interface: ethernet1/1/53 send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present admin: up state: present - type: ipv4 interface: ethernet1/1/55 send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present admin: up state: present os10_vxlan: anycast_gateway_mac: "00:01:01:01:01:01" nve: source_interface: "0" state: "present" evpn: autoevi: True rmac: 00:00:01:02:03:04 vrf: - name: "TENANT1" vni: 3000 route_target: - type: "manual" asn_value: "3000:3000" route_target_type: "both" state: "present" virtual_network: virtual_net: - id: 1002 member_interface: - ifname: "ethernet 1/1/1" type: "tagged" vlanid: 102 state: "present" vxlan_vni: id: 1002 state: "present" state: "present" - id: 1008 member_interface: - ifname: "ethernet 1/1/1" type: "tagged" vlanid: 108 state: "present" vxlan_vni: id: 1008 state: "present" state: "present"
- Save and close the file:
- To exit Insert mode, press the Esc key.
- To save the file, type the following command:
: wq
- Press the Enter key.
Create the Leaf 3 variable file
To create the Leaf 3 variable file, perform the following steps:
- To create a file in the host_vars directory, open Vim and type the following command:
root@AnsibleNode:~/POC# vim host_vars/leaf3.yaml
Vim creates the file and the file opens. - To enter Insert mode, type i. 'INSERT' displays at the bottom of the screen.
- Copy the following statements into the leaf3.yaml file:
hostname: leaf3 ansible_ssh_user: admin ansible_ssh_pass: admin ansible network os: dellemc.os10.os10 os10_system: hostname: "Leaf3" os10_interface: loopback 0: admin: up ip_and_mask: 10.1.1.2/32 loopback 1: admin: up ip_and_mask: 10.2.2.3/32 virtual-network 1008: vrf: "TENANT1" admin: up ip_and_mask: "192.168.108.2/24" virtual_gateway_ip: "192.168.108.1" ethernet 1/1/1: desc: "link to H2" admin: up portmode: trunk ethernet 1/1/53: desc: "link to SPINE1" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/55: desc: "link to SPINE2" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 os10_vrf: vrfdetails: - vrf_name: "tenant1" state: "present" os10_bgp: asn: 65202 router_id: 10.2.2.2 ipv4_network: - address: 10.1.1.2/32 state: present neighbor: - type: ipv4 interface: ethernet1/1/53 send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present admin: up state: present - type: ipv4 interface: ethernet1/1/55 send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present admin: up state: present os10_vrf: name: "tenant1" address_family: type: "ipv4" redistribute: - route_type: "l2vpn" address_type: ipv4 state: present os10_vxlan: anycast_gateway_mac: "00:01:01:01:01:01" nve: source_interface: "0" state: "present" evpn: autoevi: True rmac: 00:00:01:02:03:05 vrf: - name: "TENANT1" vni: 3000 adv_ipv4: - type: "bgp" state: "present" route_target: - type: "manual" asn_value: "3000:3000" route_target_type: "both" state: "present" - id: 1008 member_interface: - ifname: "ethernet 1/1/1" type: "tagged" vlanid: 108 state: "present" vxlan_vni: id: 1008 state: "present" state: "present"
- Save and close the file:
- To exit Insert mode, press the Esc key.
- To save the file, type the following command:
: wq
- Press the Enter key.
Create the Spine 1 variable file
To create the Spine 1 variable file, perform the following steps:
- To create a file in the host_vars directory, open Vim and type the following command:
root@AnsibleNode:~/POC# vim host_vars/spine1.yaml
Vim creates the file and the file opens. - To enter Insert mode, type i. 'INSERT' displays at the bottom of the screen.
- Copy the following statements into the spine1.yaml file:
hostname: spine1 ansible_ssh_user: admin ansible_ssh_pass: admin ansible_network_os=dellemc.os10.os10 os10_system: hostname: "Spine1" os10_interface: loopback 1: admin: up ip_and_mask: 10.2.1.1/32 ethernet 1/1/1: desc: "link to Leaf1" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/2: desc: "link to Leaf2" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 os10_bgp: asn: 65102 router_id: 10.2.1.1 ipv4_network: - address: 10.2.1.1/32 state: present neighbor: - type: "peergroup" name: "ebgp_session" send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present state: present - type: ipv4 interface: ethernet1/1/1 peergroup: ebgp_session peergroup_type: ebgp admin: up state: present - type: ipv4 interface: ethernet1/1/2 peergroup: ebgp_session peergroup_type: ebgp admin: up state: present state: present
- Save and close the file:
- To exit Insert mode, press the Esc key.
- To save the file, type the following command:
: wq
- Press the Enter key.
Create the Spine 2 variable file
To create the Spine 2 variable file, perform the following steps:
- To create a file in the host_vars directory, open Vim and type the following command:
root@AnsibleNode:~/POC# vim host_vars/spine2.yaml
Vim creates the file and the file opens. - To enter Insert mode, type i. 'INSERT' displays at the bottom of the screen.
- Copy the following statements into the spine2.yaml file:
hostname: spine2 ansible_ssh_user: admin ansible_ssh_pass: admin ansible_network_os=dellemc.os10.os10 os10_system: hostname: "Spine2" os10_interface: loopback 1: admin: up ip_and_mask: 10.2.1.2/32 ethernet 1/1/1: desc: "link to Leaf1" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 ethernet 1/1/2: desc: "link to Leaf2" admin: up switchport: False mtu: 9216 suppress_ra: absent min_ra: 3 max_ra: 4 os10_bgp: asn: 65101 router_id: 10.2.1.2 ipv4_network: - address: 10.2.1.2/32 state: present neighbor: - type: "peergroup" name: "ebgp_session" send_community: - type: extended state: present address_family: - type: "l2vpn" activate: true state: present state: present - type: ipv4 interface: ethernet1/1/1 peergroup: ebgp_session peergroup_type: ebgp admin: up state: present - type: ipv4 interface: ethernet1/1/2 peergroup: ebgp_session peergroup_type: ebgp admin: up state: present state: present
- Save and close the file:
- To exit Insert mode, press the Esc key.
- To save the file, type the following command:
: wq
- Press the Enter key.