Ansible – My New Found Friend
I think I once read a Terry Pratchett’s book with a character who was excelling in everything only because he was too lazy. His motivation for getting excellent in everything was so he could minimise the risk of the sh*t hitting the fan. Although my motivation for improving the way I do things isn’t entirely driven by minimising bad things from happening, it is something I can relate to.
Soooo….. The big question I ask myself every time I’m doing something is – how do I get even better and more efficient in what I’m doing? What can I do differently and is this an area I should be better at or is there another way? In my line of work, doing things manually can be both the right and wrong way to do things. For instance; even though I am a good typist, I would prefer some operations to be repeatable and automated which, not only gives me piece of mind, it also ensures a consistent result. In the world of increasing efficiency, Ansible has come to my rescue.
So what is Ansible? As per their website, Ansible is “a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration and many other IT needs”. Ansible can be used to perform the same tasks across multiple servers from a central location making my goal of being efficient and excellent more achievable.
Now you may be thinking, “So what. This is not new. There are many tools that do this”.
There is one big advantage Ansible has over other management/automation tools out there in the wild (like Puppet, Chef, etc). It is simple, doesn’t require weeks of studying to get to the point where the automation playbook can be put together and best of all doesn’t change with every version. On top of that – Ansible provides tons of ready to use modules- visit Ansible’s website and read through available modules to see what is available. And if this is not enough – check the GitHub – there is at least a 50% chance someone is working on or completed what you need.
Good thing about Ansible is there are also plenty of ideas floating out there. You can search the ansible galaxy website for the topic you are interested in and there probably will be something to find. If you are a die-hard coder and you prefer to do everything your way – just go for it and develop your own playbooks or Ansible Roles.
When it comes to me – I like getting my hands dirty (metaphorically speaking…. it is IT after all) and have developed some of my own playbooks. I Automated the Red Hat/Centos hardening based on CIS – that was just for fun because I knew it would require me to learn plenty of new things about Ansible playbooks. This project was followed by a complete install and config for the Veritas Cluster File System with a two-node setup with fencing. It is just pure joy to run the ansible-playbook command and come back after 15 minutes and see that the task has been completed and verified. In other words – the task which usually should take around 4-6h can be finalised in 15min. There are plenty of other playbooks I developed over time. Another really cool playbook I created for the customer was to create a six node Gluster Cluster with 13 volumes.
Why Bother you may ask? The answer is – when you have 13 volumes spread across 6 nodes, the implication is you need to create thinly provisioned logical volumes on each machines x 13… around 78 tasks. After preparing one volume across 6 nodes and repeating the tasks several times due to the spelling mistakes or other silly things like that, we agreed with the customer that I will spend a day to create the playbook. Once the playbook was ready, the complete setup of the Gluster Cluster took around 10 min. This involved: installation of the tasks, forming the cluster, preparing logical volumes across all nodes for 13 Gluster Volumes, creating Gluster Volumes in the configuration designed, starting the volumes, tuning the system and the volumes and finally making the system ready for the consumption. This cookie-cutter helped deploying other gluster clusters in literally no-time, allowing me and the business to provide additional help and our client loved it! Not only that, the code is entirely reusable and can easily be edited to cater for different Gluster clusters.
Ansible is my new best friend for work. It is fun to hang out with, easy to get to know, looks after me when in times of need and stops me making mistakes. I love it when work is fun!
Join the Insentra Community with the Insentragram Newsletter
Hungry for more?
Project Management and Change Management – How Insentra ensures projects run smoothly
By [Marni Noble]
I am going to say something that will really blow your mind… are you ready? It seems in business today that change is the only constant in this crazy fast-paced world of variables.
Farewell Smart Scale, Hello Autoscale…
In some cases, ‘farewells’ can carry a little sadness and it’s no different in the land of technology when a product or service that brought value, gets sent to the chopping block via a decision made by the vendor for the greater good (in most cases…)