Previously we have intorduced Ansible. Therefore, this article will discuss about how to install and configure Ansible on linux.
In short, Ansible is an agentless automation tool that is using SSH and python to manage remote servers. It does not need database server or running as daemon or service. You can easily install on a server or a laptop and that’s it, after that you can start using Ansible to manage an entire fleet of remote servers from your laptop.
When Ansible manages remote machines, it does not leave software installed or running on them. So there’s no real question about how to upgrade Ansible when moving to a new version. In addition, currently Ansible can be run from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed.
Ansible only needs python2 (version 2.7) or python3 (version 3.5 and higher) installed on the remote servers to manage them and that’s it, no need other software or service that is why it’s called agentless.
Therefore, to understand better please take a close look on how to install and configure Ansible on linux below.
$ sudo dnf install ansible
$ sudo yum install ansible
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo apt-add-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible
Once you have installed the ansible, run command below to make sure that ansible is installed properly.
$ ansible --version
Then, you will see the output would be something like below.
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.17 (default, Sep 30 2020, 13:38:04) [GCC 7.5.0]
Due to the output, we could see that ansible has a configuration that can be optimized as your need at /etc/ansible/ansible.cfg
By default, the configuration is enough for you to make an ansible role as well as ansible read the ssh keys form ~/.ssh/id_rsa. Although It depends on what users are logging in, you still can optimize that on [ssh_connection] section. Not only you can make it more fun with optimizing the color of your ansible output, but also change it in [colors] section as well.
As I mentioned in the previous classes, you need to follow ansible hierarchy to make ansible running well. By default, ansible already created files on /etc/ansible path for inventory and roles, but you can move it to your desired path.
So, do you want to know how to use the ansible?
Please follow this link.