My Journey through Ansible
UPDATE: Yeah I got a typo in the Title and published, fixed now :)
UPDATE: Yeah I got a typo in the Title and published, fixed now :)
Hi Guys,
Ansible from RedHat is actually one of my favorite Tools in IT, since I begun to use it. Ansible in a nutshell is a automation toolkit for DSC (Desired State Configuration) using YAML files and a SSH Client.
My first contact with Ansible was a video from Lawrence PC Pickup.
In the following weeks after Tom (@TomLawrenceTech on Twitter) published that video I tried several things but never got encouraged to do more. until now, we are planning to introduce Ansible as a configuration management in the company I work in.
So after my task to get into Ansible my encouragement to learn Ansible got back, I begun with an Udemy Course named ‘Mastering Ansible’. After that I found this little GitHub repo from Turken H. which basically turns that Course into a Docker driven interactive tutorial. The repository you can find here. My next point was learning it by using it, so I decided to deploy it on my local VirtualBox, which works great for testing, I wanted to use docker first but it is simply not designed for running VM like container instead of apps. This was the Weekend after i got informed to learn Ansible for Work.
In the following week of that weekend i deployed Ansible on all my test VMs and some productive systems for Anaconda Python Environment and splunk. So I created my first playbooks for that and use git to keep track of my changes I got into Ansible quite fast.
I also learned to really unterstand was idempotent means and how to write playbooks to do so with the ‘shell’ and ‘command’ module. Since Ansible does not support some things in our infrastructure I continued with the writing of modules.
Modules can be created in several ways, they’re mostly written in Python but you can also write them in Bash which is nice, so you can rewrite your existing bash scripts into Modules by simply make them idempotent and format their output to JSON which Ansible uses to parse output of modules.
Speaking of JSON I first got mad as Ansible doesn’t use JSON to write the playbooks, but Igot the point now for that decision from the devs. Ansible playbooks are like receipts for a chef so they have to be human-readable and consistent. a JSON file is somewhat human-readable but in long playbooks it would be a mess to keep track of the curly-braces which are enclosing JSON definitions, since YAML is using simple space indentation these files are better readable.
So now you are probably asking why, since keeping track of space indentation is more likely to be prone to error. This indentation is simple to get when you use a editor which has Ansible support. Since my company uses mostly Microsoft software I went with Visual Studio Code which is since it’s first release my first option, before it was Notepad++. Microsoft has published a Ansible plugin of their own to work with VSCode which is really nice. Alternatively you can use GitHub Atom or your VIM which can also be expanded to handle Ansible files. (but Atom is now Microsoft Software and not that great :) IMHO)
In the following week I will get my Ansible Shirt which I self designed because nobody sells them at a reasonable price :) when you want to also get one please visit my Vistaprint Design. Notice: I had to rework the Ansible Diagram from RedHat on the back in GIMP to create a version with a better resolution.
So have a nice Sunday afternoon.
Shoutout to Tom Lawrence you are one of the reasons I got into IT and Linux