This article covers how to install and configure Ansible on Ubuntu 20.04. Ansible is a widely used automation tool in DevOps and used by thousands of developers and sysadmins to configure and deploy applications on servers.
It saves time and minimizes the effort required to handle a multitude of servers in a complex IT infrastructure.
To install Ansible on Ubuntu:
1. First, refresh your system’s package index with:
# sudo apt update
2. Following this update, you can install the Ansible software with:
$ sudo apt install ansible
Press Y when prompted to confirm installation.
To check if Ansible is able to connect to these servers and run commands via SSH:
From your local machine or Ansible control node, run:
$ ansible all -m ping -u root
This command will use Ansible's built-in ping module to run a connectivity test on all nodes from your default inventory, connecting as root.
The ping module will test:
i. if hosts are accessible;
ii. if you have valid SSH credentials;
iii. if hosts are able to run Ansible modules using Python.