What can Ansible Automate?
When you start learning Ansible you might be wondering. What can Ansible automate? I know I had a hard time conceptualizing what could be automated. For me, this stemmed from a lack of understanding of all the capabilities of Ansible. I was not fully able to understand this until I started using Ansible and found specific scenarios I wanted to solve. Hopefully, some of the examples I provide will rattle some ideas loose upstairs. Take these and run with them, automate it all!
At its core automation is used for repetitive tasks. However, it does not need to massively complex. It could be some simple changes. When I think of repetitive tasks I think of changing the DNS servers on 500 switches, standardizing the hostnames of all devices, and quarterly password updates to name a few.
- Quarterly Password Updates – This is something the security team will hound you to do. As they should be, this used to be a daunting task fraught with error and the potential to lock yourself out of a device. With Ansible, you can have it automatically generate the passwords, update devices, and store the password securely where you choose. The best part is you can write this playbook to reset passwords across multiple vendors and operating systems.
- Updating DNS Servers – We’re using DNS as an example but simple config directives are really what it is. You use ansible to update all the DNS servers on your routers, switches, and servers. This is useful when redoing IP addresses of your core infrastructure and updating references to it ( cause who uses DNS ).
- Standardizing Hostnames – Over the years hostname standards skew. Take ansible and automate the updating to a standardized naming scheme.
Automating the configuration and application of configurations is the cornerstone of NetDevOps. Using a Source of Truth you can pull configuration directives and use Jinga2 to dynamically generate configuration. The power of Jinga2 allows you to create different templates for different vendors so replacing a device with a new vendor has never been easier.
You can also create configurations for applications like Nginx, Apache, and MariaDB. I’ve done this many times where I have the dev team provide the information to generate the config for a new load balancer in Nginx. This saves me time and keeps things accurate and error-free.
The bane of every IT team, documentation. It feels like you either don’t have enough, or it’s completely outdated. Documentation should be a living breathing thing. It shouldn’t be a cumbersome task that you dread doing. It should be your best friend and a requirement in your toolbox. Similar to creating configurations you can use Jinga2 to generate your documentation.
You can scrape your devices, configurations, ansible facts, etc. Format this data with a template and output it in your preferred format. The tried and true methods of excel ( CSV), PDFs, and text documents are easy enough to create with a little bit of work. These allow you to format the data in a standard way and easily distribute it to other team members. A more modern approach is to store this data in a database ( which could also be your source of truth). When storing it in a database this allows you to run reports dynamically to get the info you need when you need it.
I hope this article gives you some ideas on what can Ansible automate. What helped me, in the beginning, was picking a problem I wanted to solve. I then broke this into smaller problems and started solving them. As I started solving I realized areas to improve and how I could expand and automate more. Pretty soon you’ll be automating your entire network with Infrastructure as Code and NetDevOps. If your company is looking to start automating your network check out our services, and contact us.