Ansible has been around for a while and is popular among server and network engineers. As the product matures the community backing and support keeps growing and getting stronger.
On the server side of the house, Ansible is great at automating the build and deployment of service stacks on hardware, VMs or in the cloud. This is were Ansible started and is the strongest in my opinion. On the network side, Ansible is still growing and has some challenges with managing network devices. I dont blame Ansible for this, but blame the vendors for the outdated means of communication with their equipment. This is changing but its going to take time.
With that being said, Ansible is still a great tool to automate the configuration and deployment of network equipment.
Over the next few post I am going to cover the basics of Ansible and then walk through building out both the Arista and Cumulus networks we just built up.
So lets get started!
NTC Slack - Ansible
The server I will be using for this post is running Ubuntu 16.04. But feel free to set it up on any linux based OS or Mac OS. Sorry Windows dudes.
Install Ansible (Ubuntu)
Add PPA to /etc/apt/sources.list
Then update and install ansible via apt-get. For Red Hat you will be using yum.
After the install is finished verify Ansible is installed with ansible --version
Version 2 or higher is what we are looking for.
Next we need to setup the environment we are going to work in. From the home directory Im creating a new directory called dc-networks. Change into that directory and create an ansible.cfg file.
Add the following and save.
Next I highly recommend installing ntc-ansible. If your not familiar with NetworktoCode then you are missing out! These guys have been focused on network automation consulting and training to help give you and your team a jump start on automation. They have developed multiple network focused Ansible modules that will save you a ton of time as you dig deeper.
Make sure to check out the NTC slack team. They have tons of great network focused automation channels including a pretty active Ansible channel.
To install ntc-ansible make sure you are still in the dc-network directory and pull the ntc-ansible package down from GitHub. Install instructions can also be found here.
You can install ntc-ansible in a more central location for use with multiple playbooks.You will just need to update the ansible.cfg files to reflect this.
Next install ntc-ansible dependencies. Note the apt-get packages below will be different for Red Hat/CentOS and yum.
Now we can test and make sure Ansible is functioning. Using -m we can call the ping module to test a ping to the localhost.
Awesome. We are up and running and now its time to dig into Ansible and its various components.