Dell EMC Networking Ansible Documentation¶
Introduction¶
This information explains Ansible and the Dell EMC Networking Ansible integration.
Ansible¶
Ansible is a simple agentless automation framework. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates. Ansible supports network automation as part of its core framework.
See Integration: Network Automation with Ansible for more information.
Dell EMC Networking Ansible integration¶
Starting with Ansible 2.3, the Ansible core supports Dell EMC Networking modules. You can use these to manage and automate your Dell EMC switches running OS6, OS9, and OS10. All modules are currently executed in local connection mode, using CLI and SSH transport.
See Integration: Ansible and Dell EMC Networking for more information.
Installation¶
You can install Ansible roles on the control machine using Dell EMC Networking devices.
Ansible modules¶
Dell EMC Networking Ansible modules are part of the Ansible core. Install Ansible 2.3 or later to use these modules. See Ansible documentation for more information.
Ansible roles¶
Install all Dell EMC Networking Ansible roles.
ansible-galaxy install -r dellemc_roles.txt
where dellemc_roles.txt
is defined as:
Dell-Networking.dellos-aaa
Dell-Networking.dellos-acl
Dell-Networking.dellos-bgp
Dell-Networking.dellos-copy-config
Dell-Networking.dellos-dcb
Dell-Networking.dellos-dns
Dell-Networking.dellos-ecmp
Dell-Networking.dellos-flow-monitor
Dell-Networking.dellos-image-upgrade
Dell-Networking.dellos-interface
Dell-Networking.dellos-lag
Dell-Networking.dellos-lldp
Dell-Networking.dellos-logging
Dell-Networking.dellos-ntp
Dell-Networking.dellos-prefix-list
Dell-Networking.dellos-qos
Dell-Networking.dellos-route-map
Dell-Networking.dellos-sflow
Dell-Networking.dellos-snmp
Dell-Networking.dellos-system
Dell-Networking.dellos-users
Dell-Networking.dellos-vlan
Dell-Networking.dellos-vlt
Dell-Networking.dellos-vrf
Dell-Networking.dellos-vrrp
Dell-Networking.dellos-xstp
You can also install an individual Dell EMC Networking Ansible role using a single command. For example, to install the AAA role use ansible-galaxy install Dell-Networking.dellos.aaa
.
See Ansible Galaxy for more information on Dell EMC Networking Ansible roles.
Dell EMC Networking devices¶
Dell EMC Networking devices require minimal configuration to run Ansible playbooks.
OS6¶
- Create a username and password for Ansible.
- Configure the Management interface (static/dynamic IP address).
- Enable the SSH server.
console(config)# username admin password ansible@123
console(config)# enable password ansible@123
console(config)# interface out-of-band
console(conf-if)# ip address 10.16.148.79 255.255.255.0 10.16.148.254
console(conf-if)# exit
console(config)# ip ssh server
OS9¶
- Create a username and password for Ansible.
- Configure the Management interface (static/dynamic IP address).
- Enable the SSH server.
- Set the maximum connection rate limit.
Dell(config)# username ansible password ansible
Dell(config)# enable password ansible
Dell(config)# interface managementethernet 0/0
Dell(conf-if-ma-0/0)# ip add 10.16.148.72/24
Dell(conf-if-ma-0/0)# no shutdown
Dell(conf-if-ma-0/0)# exit
Dell(config)# ip ssh server enable
Dell(config)# ip ssh connection-rate-limit 60
OS10¶
- Create an Ansible username and password.
- Configure the Management interface (static/dynamic IP address).
OS10(config)# username ansible password ansible
OS10(config)# interface mgmt 1/1/1
OS10(conf-if-ma-1/1/1)# ip address 10.16.149.62/16
OS10(conf-if-ma-1/1/1)# no shutdown
OS10(conf-if-ma-1/1/1)# do commit
OS10(conf-if-ma-1/1/1)# exit
> NOTE: SSH is enabled in OS10 by default.
- 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Dell EMC Networking Ansible modules¶
Note
Ansible has deprecated support for the template module (see Deprecations).
OS6 modules¶
- dellos6_command: Run commands on remote devices running OS6
- dellos6_config: Manage configuration sections on remote devices running OS6
- dellos6_facts: Collect facts from remote devices running OS6
OS9 modules¶
- dellos9_command: Run commands on remote devices running OS9
- dellos9_config: Manage configuration sections on remote devices running OS9
- dellos9_facts: Collect facts from remote devices running OS9
OS10 modules¶
- dellos10_command: Run commands on remote devices running OS10
- dellos10_config: Manage configuration sections on remote devices running OS10
- dellos10_facts: Collect facts from remote devices running OS10
Dell EMC Networking Ansible roles¶
The Dell EMC Networking Ansible roles facilitate device provisioning running Dell EMC Networking OS6, OS9, or OS10. This information describes the Dell EMC Networking Ansible roles.
AAA role¶
The dellos-aaa role facilitates the configuration of authentication authorization acccounting (AAA), and supports the configuration of TACACS and RADIUS server and AAA.
Abstracted for OS9
ACL role¶
The dellos-acl role facilitates the configuration of an access control list (ACL). It supports the configuration of different types of ACLs (standard and extended) for both IPv4 and IPv6, and assigns the access-class to line terminals.
Abstracted for OS9
BGP role¶
The dellos-bgp role facilitates the configuration of border gateway protocol (BGP) attributes, and supports router ID, networks, neighbors, and maximum path configurations.
Abstracted for OS6
OS9
OS10
Copy-config role¶
The dellos-copy-config role pushes the backup running configuration into a device. This role merges the configuration in the template file with the running configuration of the Dell EMC Networking device.
Abstracted for OS6
OS9
OS10
DCB role¶
The dellos-dcb role facilitates the configuration of data center bridging (DCB), supports the configuration of DCB map and DCB buffer and assigns them to interfaces.
Abstracted for OS9
DNS role¶
The dellos-dns role facilitates the configuration of domain name service (DNS).
Abstracted for OS9
ECMP role¶
The dellos-ecmp role facilitates the configuration of equal cost multi-path (ECMP). It supports the configuration of ECMP for IPv4.
Abstracted for OS9
Flow-monitor role¶
The dellos-flow-monitor role facilitates the configuration of ACL flow-based monitoring attributes. Flow-based mirroring is a mirroring session in which traffic matches specified policies that are mirrored to a destination port. Port-based mirroring maintains a database that contains all monitoring sessions (including port monitor sessions).
Abstracted for OS10
Image-upgrade role¶
The dellos-image-upgrade role facilitates upgrades or installation of an OS10 software image.
Abstracted for OS6
OS9
OS10
Interface role¶
The dellos-interface role facilitates the configuration of interface attributes. It supports the configuration of administrative state, description, MTU, IP address, IP helper, and port mode.
Abstracted for OS10
LAG role¶
The dellos-lag role facilitates the configuration of link aggregation group (LAG) attributes. This role supports the creation and deletion of a LAG and its member ports, and supports the configuration of type (static/dynamic), hash scheme, and minimum required link.
Abstracted for OS6
OS9
OS10
LLDP role¶
The dellos-lldp role facilitates the configuration of link layer discovery protocol (LLDP) attributes at global and interface level. This role supports the configuration of hello, mode, multiplier, advertise tlvs, management interface, fcoe, iscsi at global and interface levels.
Abstracted for OS9
OS10
Logging role¶
The dellos-logging role facilitates the configuration of global logging attributes, and supports the configuration of logging servers.
Abstracted for OS6
OS9
OS10
NTP role¶
The dellos-ntp role facilitates the configuration of network time protocol attributes.
Abstracted for OS6
OS9
OS10
Prefix-list role¶
The dellos-prefix-list role facilitates the configuration of a prefix-list, supports the configuration of IP prefix-list, and assigns the prefix-list to line terminals.
Abstracted for OS9
QoS role¶
The dellos-qos role facilitates the configuration of quality of service attributes including policy-map and class-map.
Abstracted for OS10
Route-map role¶
The dellos-route-map role facilitates the configuration of route-map attributes.
Abstracted for OS10
sFlow role¶
The dellos-sflow role facilitates the configuration of global and interface-level sflow attributes. This role supports the configuration of sflow collectors at the global level, enabling and disabling of sflow and specification of sflow polling-interval, sample-rate, max-datagram sizs, and so on are supported at interface and global levels.
Abstracted for OS9
SNMP role¶
The dellos-snmp role facilitates the configuration of global snmp attributes. It supports the configuration of SNMP server attributes like users, group, community, location, traps, and so on.
Abstracted for OS9
OS10
System role¶
The dellos-system role facilitates the configuration of global system attributes. This role specifically enables configuration of hostname, NTP server, and enables the password for dellos6, dellos9, and dellos10. dellos9 supports the configuration of the management route, hash alogrithm, clock, line terminal, banner and reload type.
Abstracted for OS6
OS9
OS10
Users role¶
The dellos-users role facilitates the configuration of global system user attributes. This role supports the configuration of CLI users.
Abstracted for OS6
OS9
OS10
VLAN role¶
The dellos-vlan role facilitates configuring virtual LAN (VLAN) attributes. This role supports the creation and deletion of a VLAN and its member ports.
Abstracted for OS6
OS9
OS10
VLT role¶
The dellos-vlt role facilitates the configuration of the basics of virtual link trunking (VLT) to provide a loop-free topology.
Abstracted for OS9
OS10
VRF role¶
The dellos-vrf role facilitates the configuration of basic virtual routing and forwarding (VRF) that helps in the partition of physical routers to multiple virtual routers.
Abstracted for OS9
VRRP role¶
The dellos-vrrp role facilitates configuration of virtual router redundancy protocol (VRRP) attributes. This role supports the creation of vrrp groups for interfaces, and setting the vrrp group attributes.
Abstracted for OS6
OS9
OS10
xSTP role¶
The dellos-xstp role facilitates the configuration of xSTP attributes. This role supports multiple version of spanning-tree protocol (STP), rapid spanning-tree (RSTP) protocol, multiple spanning-tree (MST), and per-VLAN spanning-tree (PVST). This role supports the configuration of bridge priority, enabling and disabling spanning-tree, creating and deleting instances, and mapping virtual LAN (VLAN) to instances.
Abstracted for OS6
OS9
OS10
Support matrix of Dell EMC Networking Ansible roles¶
This table shows the support matrix between Ansible roles and Dell EMC Networking OS6, OS9, and OS10.
Role | OS6 | OS9 | OS10 |
---|---|---|---|
dellos-aaa | No | Yes | Yes |
dellos-acl | No | Yes | Yes |
dellos-bgp | Yes | Yes | Yes |
dellos-copy-config | No | Yes | Yes |
dellos-dcb | No | Yes | Yes |
dellos-dns | No | Yes | Yes |
dellos-ecmp | No | Yes | Yes |
dellos-flow-monitor | No | No | Yes |
dellos-image-upgrade | No | No | Yes |
dellos-interface | Yes | Yes | Yes |
dellos-lag | Yes | Yes | Yes |
dellos-lldp | No | Yes | Yes |
dellos-logging | Yes | Yes | Yes |
dellos-ntp | Yes | Yes | Yes |
dellos-prefix-list | No | Yes | Yes |
dellos-qos | No | No | Yes |
dellos-route-map | No | No | Yes |
dellos-sflow | No | Yes | Yes |
dellos-snmp | Yes | Yes | Yes |
dellos-system | Yes | Yes | Yes |
dellos-users | Yes | Yes | Yes |
dellos-vlan | Yes | Yes | Yes |
dellos-vlt | No | Yes | Yes |
dellos-vrf | No | Yes | Yes |
dellos-vrrp | Yes | Yes | Yes |
dellos-xstp | Yes | Yes | Yes |
Dell EMC Networking Ansible module examples¶
These module examples explain how to create a simple Ansible playbook, run the Dell EMC Networking Ansible modules, then configure a switch using Ansible roles.
Create simple Ansible playbook¶
- Create an inventory file called inventory.yaml and specify the IP address.
spine1 ansible_host=10.11.182.16
- Create a host variable file called host_vars/spine1.yaml then define the host, credentials, and transport.
hostname: spine1
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_become_method: enable
ansible_become: yes
ansible_become_pass: xxxxx
ansible_network_os: xxxxx
- Create a playbook called showver.yaml.
hosts: spine1
connection: network_cli
gather_facts: no
tasks:
- name: "Get Dell EMC OS9 Show version"
dellos9_command:
commands: ['show version']
register: show_ver
- debug: var=show_ver
- Run the playbook
ansible-playbook -i inventory.yaml showver.yaml
Run Dell EMC Networking Ansible examples¶
Use these sample Ansible playbooks to understand how to use Dell EMC Networking Ansible modules.
Installation and setup¶
- Install Ansible.
- Clone the Ansible-dellos-examples repository in the control machine.
- Update the inventory.yaml file to configure the device IP.
- Update the corresponding host variables (use hosts_var/dellos10_sw1.yaml for device credentials).
OS6¶
dellos6_facts module that collects the facts from the OS6 device example
ansible-playbook -i inventory.yaml getfacts_os6.yaml
dellos6_command module that executes the show version command example
ansible-playbook -i inventory.yaml showver_os6.yaml
dellos6_config module that configures the hostname on the OS6 device example
ansible-playbook -vvv -i inventory.yaml hostname_os6.yaml
OS9¶
dellos9_facts module that collects the facts from the OS9 device example
ansible-playbook -i inventory.yaml getfacts_os9.yaml
dellos9_command module that executes the show version command example
ansible-playbook -i inventory.yaml showver_os9.yaml
dellos9_config module that configures the hostname on the OS9 device example
ansible-playbook -vvv -i inventory.yaml hostname_os9.yaml
OS10¶
dellos10_facts module that collects the facts from the OS10 device example
ansible-playbook -i inventory.yaml getfacts_os10.yaml
dellos10_command module that executes the show version command example
ansible-playbook -i inventory.yaml showver_os10.yaml
dellos10_config module that configures the hostname on the OS10 device example
ansible-playbook -vvv -i inventory.yaml hostname_os10.yaml
Playbook using Ansible roles example¶
Use these examples to configure the switch using Ansible roles.
- Create an inventory file called inventory.yaml and specify the device IP address.
spine1 ansible_host= <ip_address>
- Create a host variable file called host_vars/spine1.yaml then define the host, credentials, and transport.
---
hostname: dellos9
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_become: yes
ansible_become_method: enable
ansible_become_pass: xxxxx
ansible_network_os: dellos9
dellos_interface:
fortyGigE 0/32:
desc: "Connected to Spine1"
portmode:
switchport: False
mtu: 2500
admin: up
ipv6_and_mask: 2001:4898:5808:ffa2::5/126
suppress_ra : present
ip_type_dynamic: true
ip_and_mask: 192.168.23.22/24
class_vendor_identifier: present
option82: true
remote_id: hostname
fortyGigE 0/20:
portmode:
switchport: False
fortyGigE 0/64:
portmode:
switchport: True
fortyGigE 0/60:
portmode:
switchport: True
fortyGigE 0/12:
portmode:
switchport: True
loopback 0:
ip_and_mask: 1.1.1.1/32
admin: up
Port-channel 12:
switchport: True
dellos_vlan:
vlan 100:
name: "Mgmt Network"
description: "Int-vlan"
tagged_members:
- port: fortyGigE 0/60
state: present
untagged_members:
- port: fortyGigE 0/12
state: present
state: present
- Create a playbook called switch_config.yaml.
---
- hosts: dellos9
gather_facts: no
connection: network_cli
roles:
- Dell-Networking.dellos-interface
- Dell-Networking.dellos-vlan
- Run the playbook.
ansible-playbook -i inventory.yaml switch_config.yaml
Provision CLOS fabric using Dell EMC Networking Ansible modules example¶
This example describes how to use Ansible to build a CLOS fabric with Dell EMC Networking OS10 switches. The sample topology is a two-tier CLOS fabric with two spines and four leafs connected as mesh. EBGP is running between the two tiers.
All switches in spine have the same AS number, and each leaf switch has a unique AS number. All AS number used are private. For application load-balancing purposes, the same prefix is advertised from multiple leaf switches and uses BGP multipath relax feature.
Creating a Simple Ansible Playbook¶
Step 1
Create an inventory file called inventory.yaml
and specify the device IP address:
spine1 ansible_host=10.11.182.25
spine2 ansible_host=10.11.182.26
leaf1 ansible_host=10.11.182.27
leaf2 ansible_host=10.11.182.28
leaf3 ansible_host=10.11.182.29
leaf4 ansible_host=10.11.182.30
[spine]
spine1
spine2
[leaf]
leaf1
leaf2
leaf3
leaf4
[datacenter:children]
spine
leaf
Step 2
Create a host variable file called host_vars/spine1.yaml
, then define the host, credentials and transport:
hostname: spine1
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_interface:
ethernet 1/1/1:
desc: "Connected to leaf 1"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.1.1/24
ipv6_and_mask: 2001:100:1:1::1/64
state_ipv6: present
ethernet 1/1/17:
desc: "Connected to leaf 2"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.33.1/24
ipv6_and_mask: 2001:100:1:21::1/64
state_ipv6: present
ethernet 1/1/25:
desc: "Connected to leaf 3"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.17.1/24
ipv6_and_mask: 2001:100:1:11::1/64
state_ipv6: present
ethernet 1/1/9:
desc: "Connected to leaf 4"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.49.1/24
ipv6_and_mask: 2001:100:1:31::1/64
state_ipv6: present
dellos_bgp:
asn: 64901
router_id: 100.0.1.1
best_path:
as_path: multipath-relax
as_path_state: present
med:
- attribute: missing-as-worst
state: present
neighbor:
- type: ipv4
remote_asn: 64801
ip: 100.1.1.2
admin: up
state: present
- type: ipv4
remote_asn: 64803
ip: 100.1.33.2
admin: up
state: present
- type: ipv4
remote_asn: 64802
ip: 100.1.17.2
admin: up
state: present
- type: ipv4
remote_asn: 64804
ip: 100.1.49.2
admin: up
state: present
- type: ipv6
remote_asn: 64801
ip: 2001:100:1:1::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64802
ip: 2001:100:1:11::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64803
ip: 2001:100:1:21::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64804
ip: 2001:100:1:31::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
dellos_snmp:
snmp_community:
- name: public
access_mode: ro
state: present
hostname: spine2
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_interface:
ethernet 1/1/1:
desc: "Connected to leaf 1"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.1.1/24
ipv6_and_mask: 2001:100:2:1::1/64
state_ipv6: present
ethernet 1/1/25:
desc: "Connected to leaf 2"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.17.1/24
ipv6_and_mask: 2001:100:2:11::1/64
state_ipv6: present
ethernet 1/1/17:
desc: "Connected to leaf 3"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.33.1/24
ipv6_and_mask: 2001:100:2:21::1/64
state_ipv6: present
ethernet 1/1/9:
desc: "Connected to leaf 4"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.49.1/24
ipv6_and_mask: 2001:100:2:31::1/64
state_ipv6: present
dellos_bgp:
asn: 64901
router_id: 100.0.1.2
best_path:
as_path: multipath-relax
as_path_state: present
med:
- attribute: missing-as-worst
state: present
neighbor:
- type: ipv4
remote_asn: 64801
ip: 100.2.1.2
admin: up
state: present
- type: ipv4
remote_asn: 64802
ip: 100.2.33.2
admin: up
state: present
- type: ipv4
remote_asn: 64803
ip: 100.2.17.2
admin: up
state: present
- type: ipv4
remote_asn: 64804
ip: 100.2.49.2
admin: up
state: present
- type: ipv6
remote_asn: 64801
ip: 2001:100:2:1::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64802
ip: 2001:100:2:11::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64803
ip: 2001:100:2:21::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64804
ip: 2001:100:2:31::2
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
state: present
dellos_snmp:
snmp_community:
- name: public
access_mode: ro
state: present
hostname: leaf1
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_system:
hash_algo:
algo:
- name: ecmp
mode: crc
state: present
dellos_interface:
ethernet 1/1/1:
desc: "Connected to Spine 1"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.1.2/24
ipv6_and_mask: 2001:100:1:1::2/64
state_ipv6: present
ethernet 1/1/9:
desc: "Connected to Spine 2"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.1.2/24
ipv6_and_mask: 2001:100:2:1::2/64
state_ipv6: present
dellos_bgp:
asn: 64801
router_id: 100.0.2.1
address_family_ipv4: true
address_family_ipv6: true
best_path:
as_path: multipath-relax
as_path_state: present
med:
- attribute: missing-as-worst
state: present
neighbor:
- type: ipv4
remote_asn: 64901
ip: 100.1.1.1
admin: up
state: present
- type: ipv4
remote_asn: 64901
ip: 100.2.1.1
admin: up
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:1:1::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:2:1::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
state: present
dellos_snmp:
snmp_community:
- name: public
access_mode: ro
state: present
hostname: leaf2
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_system:
hash_algo:
algo:
- name: ecmp
mode: crc
state: present
dellos_interface:
ethernet 1/1/1:
desc: "Connected to Spine 1"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.17.2/24
ipv6_and_mask: 2001:100:1:11::2/64
state_ipv6: present
ethernet 1/1/9:
desc: "Connected to Spine 2"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.17.2/24
ipv6_and_mask: 2001:100:2:11::2/64
dellos_bgp:
asn: 64802
router_id: 100.0.2.2
address_family_ipv4: true
address_family_ipv6: true
best_path:
as_path: multipath-relax
as_path_state: present
med:
- attribute: missing-as-worst
state: present
neighbor:
- type: ipv4
remote_asn: 64901
ip: 100.1.18.1
admin: up
state: present
- type: ipv4
remote_asn: 64901
ip: 100.1.17.1
admin: up
state: present
- type: ipv4
remote_asn: 64901
ip: 100.2.17.1
admin: up
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:1:11::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:2:11::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
dellos_snmp:
snmp_community:
- name: public
access_mode: ro
state: present
hostname: leaf3
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_system:
hash_algo:
algo:
- name: ecmp
mode: crc
state: present
dellos_interface:
ethernet 1/1/1:
desc: "Connected to Spine 1"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.33.2/24
ipv6_and_mask: 2001:100:1:21::2/64
state_ipv6: present
ethernet 1/1/9:
desc: "Connected to Spine 2"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.33.2/24
ipv6_and_mask: 2001:100:2:21::2/64
dellos_bgp:
asn: 64803
router_id: 100.0.2.3
address_family_ipv4: true
address_family_ipv6: true
best_path:
as_path: multipath-relax
as_path_state: present
med:
- attribute: missing-as-worst
state: present
neighbor:
- type: ipv4
remote_asn: 64901
ip: 100.1.33.1
admin: up
state: present
- type: ipv4
remote_asn: 64901
ip: 100.2.33.1
admin: up
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:1:21::1
admin: up
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:1:22::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:2:21::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
dellos_snmp:
snmp_community:
- name: public
access_mode: ro
state: present
hostname: leaf4
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_system:
hash_algo:
algo:
- name: ecmp
mode: crc
state: present
dellos_interface:
ethernet 1/1/5:
desc: "Connected to Spine 1"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.1.49.2/24
ipv6_and_mask: 2001:100:1:31::2/64
state_ipv6: present
ethernet 1/1/17:
desc: "Connected to Spine 2"
mtu: 9216
portmode:
admin: up
switchport: False
ip_and_mask: 100.2.49.2/24
ipv6_and_mask: 2001:100:2:31::2/64
state_ipv6: present
dellos_bgp:
asn: 64804
router_id: 100.0.2.4
address_family_ipv4: true
address_family_ipv6: true
best_path:
as_path: multipath-relax
as_path_state: present
med:
- attribute: missing-as-worst
state: present
neighbor:
- type: ipv4
remote_asn: 64901
ip: 100.1.49.1
admin: up
state: present
- type: ipv4
remote_asn: 64901
ip: 100.2.49.1
admin: up
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:1:31::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
- type: ipv6
remote_asn: 64901
ip: 2001:100:2:31::1
admin: up
address_family:
- type: ipv4
activate: false
state: present
- type: ipv6
activate: true
state: present
state: present
dellos_snmp:
snmp_community:
- name: public
access_mode: ro
state: present
Step 3
Create a playbook called datacenter.yaml
:
---
- hosts: datacenter
gather_facts: no
connection: network_cli
roles:
- Dell-Networking.dellos-interface
- Dell-Networking.dellos-bgp
- Dell-Networking.dellos-snmp
Step 4
Execute the playbook:
ansible-playbook -i inventory.yaml datacenter.yaml
- 2017 Dell Inc. and its subsidiaries. All Rights Reserved.
Provisioning hot swap use case using Dell EMC Networking Ansible modules¶
This example use case topology includes a simple two-tier CLOS fabric with 2 spines and 4 leafs. These steps will show how you Spine 2 will be hot swapped without traffic loss.
Create simple Ansible playbook¶
- Part 1 - covers creating an inventory file and host variable file for spine2, creating a pre-step hot swap playbook, then running the playbook
- Part 2 - covers creating an inventory file and host variable file for each leaf (4), creating a playbook to delete the ecmp path for spine2 from each leaf, then running the playbook
- Part 3 - covers replacing spine2 with a new switch, booting an OS10 image, creating inventory and host variable files for the new spine2, creating a post hot swap playbook, then running the playbook
Part 1¶
Refer to the CLOS fabric example to configure a 6 node CLOS fabric with EBGP. Use the example and run the playbook.
Create an inventory file called inventory.yaml, then specify the device IP address for spine2.
spine2 ansible_host=10.16.204.57
[spine]
spine2
[leaf]
[datacenter:children]
spine
Create a host variable file called host_vars/spine2.yaml
, then define the host and credentials.
- Take a backup of the running configuration to a remote location
- Shut down the BGP neighbors in the hot swap switch to avoid traffic drop
hostname: spine2
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
copy_running_remote:
- copy_type: scp
username: linuxadmin
password: linuxadmin
host_ip: 10.16.204.62
file_path: /home/linuxadmin/running-config
dellos_bgp:
asn: 64901
neighbor:
- type: ipv4
remote_asn: 64801
ip: 100.2.1.2
admin: down
state: present
- type: ipv4
remote_asn: 64802
ip: 100.2.33.2
admin: down
state: present
- type: ipv4
remote_asn: 64803
ip: 100.2.17.2
admin: down
state: present
- type: ipv4
remote_asn: 64804
ip: 100.2.49.2
admin: down
state: present
- type: ipv6
remote_asn: 64801
ip: 2001:100:2:1::2
admin: down
state: present
- type: ipv6
remote_asn: 64802
ip: 2001:100:2:11::2
admin: down
state: present
- type: ipv6
remote_asn: 64803
ip: 2001:100:2:21::2
admin: down
state: present
- type: ipv6
remote_asn: 64804
ip: 2001:100:2:31::2
admin: down
state: present
state: present
Create a playbook called hot_swap_pre_step.yaml
:
---
- hosts: datacenter
gather_facts: no
connection: network_cli
tasks:
- name: Assembling configfurations
assemble: src={{ build_dir }} dest={{ build_dir }}/{{hostname}}.conf regexp='\\S_{{hostname}}\\S'
- name: "copy running config to remote location"
dellos10_command:
commands:
- command: 'copy running-configuration {{item.copy_type}}://{{item.username}}:{{item.password}}@{{item.host_ip}}:{{item.file_path}}'
#If the switch asks for credentials for copy command, use the below commented statements to give the prompt and password
#prompt: 'admin:'
#answer: 'admin'
with_items: '{{copy_running_remote}}'
- hosts: datacenter
connection: network_cli
vars:
build_dir: "/root/debug"
roles:
- Dell-Networking.dellos-bgp
Run the playbook.
ansible-playbook -i inventory.yaml hot_swap_pre_step.yaml
Part 2¶
- After shutting the neighborship in the spine2 switch, check if the ECMP path to spine2 is deleted in each of the leaf switches.
Create an inventory file called inventory.yaml
, then specify the device IP address of all leaf switches:
leaf1 ansible_host=10.16.204.27
leaf2 ansible_host=10.16.204.28
leaf3 ansible_host=10.16.204.29
leaf4 ansible_host=10.16.204.30
[spine]
[leaf]
leaf1
leaf2
leaf3
leaf4
[datacenter:children]
leaf
Create a host variable file called host_vars/leaf1.yaml
, then define the host and credentials. The remote_neighbor_ip is the EBGP neighbor IP of spine2 with each of each leaf switch (see the CLOS fabric example for EBGP configuration):
hostname: leaf1
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
remote_neighbor_ip: "100.2.1.1"
Create a host variable file called host_vars/leaf2.yaml
, then define the host and credentials:
hostname: leaf2
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
remote_neighbor_ip: "100.2.17.1"
Create a host variable file called host_vars/leaf3.yaml
, then define the host and credentials:
hostname: leaf3
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
remote_neighbor_ip: "100.2.33.1"
Create a host variable file called host_vars/leaf4.yaml
, then define the host and credentials:
hostname: leaf4
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
remote_neighbor_ip: "100.2.49.1"
Create a playbook called waitfor_ecmp_path_delete.yaml
Note
A debug message will print when the ECMP path for spine2 is deleted in each of the leaf switches.
---
- hosts: datacenter
gather_facts: no
connection: network_cli
vars:
build_dir: "/root/debug"
tasks:
- name: Assembling configfurations
assemble: src={{ build_dir }} dest={{ build_dir }}/{{hostname}}.conf regexp='\\S_{{hostname}}\\S'
- name: "Wait for spine2 routes delete in {{ hostname }}"
dellos10_command:
commands:
- command: "show ip route bgp | grep {{ remote_neighbor_ip }}"
retries: 10
delay: 5
register: result
until: result.stdout[0] == ""
- debug:
msg: "{{ hostname }} has deleted the ECMP to spine2 switch"
when: result.stdout[0] == ""
- Execute the playbook.
ansible-playbook -i inventory.yaml waitfor_ecmp_path_delete.yaml
Part 3¶
After checking the spine2 ECMP path deletion in all leaf switches, replace spine2 with a new switch. The new spine2 switch should be connected as the old spine switch after it boots up with an OS10 image.
- Manually assign the same spine2 management IP address (for example, 10.16.204.57)
- Use the Management IP provided by the DHCP server
Create an inventory file called inventory.yaml, then specify the device IP address for spine2. The device IP can be same spine2 IP or an IP obtained from the DHCP server (x.x.x.x).
spine2 ansible_host=x.x.x.x
[spine]
spine2
[leaf]
[datacenter:children]
spine
- Create a host variable file called host_vars/spine2.yaml, then define the host, credentials, and apply the same backup configuration that was saved earlier.
hostname: spine2
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
copy_remote_running:
- copy_type: scp
username: linuxadmin
password: linuxadmin
host_ip: 10.16.204.62
file_path: /home/linuxadmin/running-config
Create a playbook called hot_swap_post_step.yaml
---
- hosts: datacenter
gather_facts: no
connection: network_cli
tasks:
- name: Assembling configfurations
assemble: src={{ build_dir }} dest={{ build_dir }}/{{hostname}}.conf regexp='\\S_{{hostname}}\\S'
- name: "copy running config to remote location"
dellos10_command:
commands:
- command: 'copy {{item.copy_type}}://{{item.username}}:{{item.password}}@{{item.host_ip}}:{{item.file_path}} running-configuration'
#If the switch asks for credentials for copy command, use the below commented statements to give the prompt and password
#prompt: 'admin:'
#answer: 'admin'
with_items: '{{copy_remote_running}}'
Execute the playbook:
ansible-playbook -i inventory.yaml hot_swap_post_step.yaml
- 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Install or upgrade devices running Dell EMC Networking OS10 using Ansible¶
This example explains how to use Ansible to install or upgrade the software image on a device running Dell EMC Networking OS10. The example playbook uses the dellos-image-upgrade role to upgrade or install an OS10 image on a specified switch. Before using Ansible to install the software image, you must download the software image via FTP/TFTP/SCP/HTTPDS, then specify the path to the image in the playbook.
The dellos-image-upgrade role uses the dellos10_command
to install or upgrade the switch, then and wait_for
is used to identify the progress of the upgrade operation. Validation of the upgrade operation is handled using the dellos10_facts
module.
Creating simple Ansible playbook¶
Step 1¶
Create an inventory file called inventory.yaml
, then specify the device IP address.
spine1 ansible_host=2.2.2.1
[spine]
spine1
[datacenter:children]
spine
Step 2¶
Create a host variable file called host_vars/spine1.yaml
then define the host, credentials, and transport:
hostname: spine1
ansible_ssh_user: xxxxx
ansible_ssh_pass: xxxxx
ansible_network_os: dellos10
dellos_image_upgrade:
operation_type: install
software_image_url: tftp://1.1.1.1/PKGS_OS10-Enterprise-10.2.9999E.5790-installer-x86_64.bin
software_version: 10.2.9999E
Step 3¶
Create a playbook called datacenter.yaml
:
---
- hosts: datacenter
gather_facts: no
connection:network_cli
roles:
- Dell-Networking.dellos-image-upgrade
Step 4¶
Execute the playbook:
ansible-playbook -i inventory.yaml datacenter.yaml
- 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Frequently asked questions¶
You can easily find answers to commonly asked questions about Dell EMC Networking Ansible modules and roles.
Q: Which version of Ansible supports Dell EMC Networking Ansible modules?
A: Ansible 2.2 and later.
Q: What are the minimum OS versions for Ansible support?
A: OS version 6.3.1 and above; OS version 9.10.0.1P13 and above; OS version 10.2 and later.
Q: What do the Dell EMC Networking Ansible roles provide?
A: The roles are a package of multiple Dell EMC Networking OS features which are provided for easy installation, configuration, and packaging. They currently contain configuration for system, interface, VLAN, LAG, BGP, and xSTP.
Q: Do Dell EMC Networking Ansible roles work with Ansible Tower?
A: Yes, these roles work with Ansible Tower for management.
Q: Is there dnosX_template module support for OS6/OS9/OS10?
A: No. Ansible has deprecated support for the template module, replacing it with the config module (see Deprecations).
Release notes¶
This information contains the release notes for Dell EMC Networking Ansible support.
Release 3.0.0¶
This release introduces new roles:
- dellos-copy-config
- dellos-flow-monitor
- dellos-image-upgrade
- dellos-ntp
- dellos-qos
- dellos-route-map
Release 2.0.0¶
This release introduces new roles:
- dellos-aaa
- dellos-acl
- dellos-dcb
- dellos-dns
- dellos-ecmp
- dellos-lldp
- dellos-prefix-list
- dellos-sflow
- dellos-vlt
- dellos-vrf
- dellos-vrrp
- dellos-snmp*
- dellos-users*
- dellos-logging*
Note
Roles with an asterisk (*) are part of dellos-system role in version 1.0.0.
Release 1.0.0¶
This release introduces:
Initial Ansible support for Dell EMC Networking OS6, OS9, and OS10.
New modules:
- dellos6_command
- dellos6_config
- dellos6_facts
- dellos9_command
- dellos9_config
- dellos9_facts
- dellos10_command
- dellos10_config
- dellos10_facts
New roles:
- dellos-bgp
- dellos-interface
- dellos-lag
- dellos-system
- dellos-vlan
- dellos-xstp
Known issues:
- dellos9_command ansible hangs after reload command issued to remote device (see Issue 5462)
- dellos9_command confirm prompt timeout (see Issue 5534)
Support¶
You can submit issues for Dell EMC Networking modules at Ansible Github Issues.
Submit issues for Dell EMC Networking roles at:
- dellos-aaa role
- dellos-acl role
- dellos-bgp role
- dellos-copy-config role
- dellos-dcb role
- dellos-dns role
- dellos-ecmp role
- dellos-flow-monitor role
- dellos-image-upgrade role
- dellos-interface role
- dellos-lag role
- dellos-lldp role
- dellos-logging role
- dellos-ntp role
- dellos-prefix-list role
- dellos-qos role
- dellos-route-map role
- dellos-sflow role
- dellos-snmp role
- dellos-system role
- dellos-users role
- dellos-vlan role
- dellos-vlt role
- dellos-vrf role
- dellos-vrrp role
- dellos-xstp role
Contact¶
You can send general comments and feedback to networking_devops_tools@dell.com.
License¶
- 2017 Dell Inc. and its subsidiaries. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.