Installing Ansible

Ansible is distributed in the Fedora, Red Hat Enterprise Linux, and CentOS operating systems in package form. In addition, it is available for different Linux distributions, apart from those mentioned previously, and we can find it available in package search engine service: https://pkgs.org/download/ansible.

For instructions on installing Ansible on other operating systems, check out the installation document: http://docs.ansible.com/ansible/intro_installation.html.

You can install Ansible on Ubuntu-and Debian-based distributions using the official package with the apt command. Here we see the steps to install the software packages; open up a Terminal:

  1. Execute the following command:
$ sudo apt-add-repository ppa:ansible/ansible

In this screenshot, you can see the execution of the previous command:

  1. Execute these commands:
$ sudo apt-get install python-software-properties
$ sudo apt-get update
$ sudo apt-get install ansible
  1. It's possible to install Ansible on Fedora systems using the official package in the yum repository:
$ sudo yum -y install ansible 
  1. Once Ansible is installed, you can check the Ansible version and files configuration with the following command:
$ ansible --version
ansible 2.7.5
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
ansible python module location = usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible

The main advantage of Ansible is that it allows us to configure many nodes in a parallel and synchronized way. There are different ways to tell Ansible which servers you are going to manage. The easy way is to add our machines to the inventory that Ansible has in our own system, which is located in /etc/ansible/hosts. In the host file, we can add the IP addresses of the machines we want to configure.

Run the ansible --help command to see the available options for executing Ansible:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset