Automate with Ansible: Part 1 - Installation
But Why?¶
The way I see it, it's a two parts question. The first and the obvious one is why to automate anything at all? To answer why, we must first understand "when"; when should we consider automation as a solution? Well, setting up the automation is only fruitful if there is some task that need to be done again and again. Automating the repetitive tasks will increase efficiency and enhance consistency.
And other one is why to use Ansible to do it? Ansible ensures that every execution produces the same results, no matter how many times they are executed. Ansible uses YAML for playbooks, making it easy to read and write, even for those new to automation or programming. And on top of all these, ansible is version-controllable.
The Installation¶
If we check out the official installation guide, we will find different ways to install ansible based on which operating system we are using or what tools are already installed. The most easiest one is to leverage the in-built Python interpreter.
python3 -m pip install --user ansible
If we are planning to use some specific operating system, we can use the default package manager of that OS. For instance, in Ubuntu, we can do the following.
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible