Dell OS6 Campus Switches with Ansible

In my last post on configuring a Spine/Leaf setup with Dell OS10 and Ansible, I continue on here in similar vein with Dell OS6 Campus switches this time and how to leverage Ansible for configuration deployment and information gathering.

My setup is very simple for this example, I have the Ansible control server and 2 Dell N-3048 series switches as my test devices.

In the first example I want to do 3 things. Get a list of interfaces of each device and its status. Secondly get the mac address tables off each device to see what’s connected and on which interface. Thirdly I want to take a backup/snapshot of the current config and back it up to a directory on my control server for later reference.

The playbook for this will look something like this:


I run my playbook with the command below:

ansible-playbook -i inventory.yaml get_mac_intf.yml

In the snippet below you can see it showing the interface status. This is the first task in the playbook:


Secondly it will run the task to get the mac address tables:


Thirdly we get a verbose output of the running configuration on the switch to the screen and then finally we back up that configuration to a local directory on our control system:


In this case the task for the backup is listed as a “COPY” operation


We can verify our running-config is in place by referencing our local configs directory


In the next example, I want to get a snapshot of what firmware version I am running on my Dell OS6 switches. I can do this quite easily with the playbook below:


When I run the playbook it gives me the information in the snippet below, from the the output of the “show version command. This could be really handy if I need to get this from not just 2 switches, but hundreds of switches that could exist in my production campus network:


Lastly, like I did in my last post for OS10, I may want to apply a standard configuration onto my campus switches. I can do this with another playbook, “stnd_config_os6.yaml”

This file looks like this:


In it I want to do 3 things, apply an ACL inline to the switches, apply standard campus VLANs and set SNMP details pertaining to my particular environment.

I run the playbook with the following command:

ansible-playbook -i inventory.yaml stnd_config_os6.yaml

I can then check my result by logging onto the switch:



In this particular case I only applied the configuration to switch 1. To verify this I can run the playbook again targeting both switches and verifying that switch 1 has a standard config applied but switch 2 has not. I achieve this by running the playbook with a flag called check mode. This validates my config and also shows a key attribute of Ansible which is idempotence, which is the ability of the tool to detect when a change is required against a device and when it is not required. This is how we avoid configuration drift and reach desired state in our network. In the below output we can see that switch 2 is out of desired state as indicated by the orange status for all 3 tasks in my playbook, and will need remediation.


All the examples in this post were produced using the standard out of the box Ansible modules for Dell Networking namely the dellos6_command and dellos6_config modules, highlighting once again how easily Ansible can be leveraged to automate your network.

In my next post I will look at how we can incorporate versioning control and workflow tools such as Git and Jenkins to keep our configurations consistent and inline with the DevOps approach of configuration management……….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s