Difference between revisions of "Install & Configure Ansible in Linux Ubuntu 18"

From Gejoreuy
Jump to navigation Jump to search
m (Gejor moved page Install Ansible in Linux Ubuntu 18 to Install & Configure Ansible in Linux Ubuntu 18 without leaving a redirect: Change tittle)
(No difference)

Latest revision as of 13:21, 10 June 2020


This page describes the process of installing Ansible in Linux Ubuntu 18.
And some example how to use Ansible to do some work in managing another servers.
Ansible is an open source IT Configuration Management, Deployment & Orchestration tool.
For more details, please see it at Ansible.


We'll do this installation in a server Linux Ubuntu 18 which called server01.
And we'll use another two servers as test to be managed, called as server02 and server03.

server01 :
server02 :
server03 :

Step by Step

Step 1 - Install Ansible

Enable our system’s list of sources.

 root@server01:~# apt-add-repository ppa:ansible/ansible

Update our machine.

 root@server01:~# apt update

Install Ansible.

 root@server01:~# apt install ansible

Step 2 - Setup Inventory File

Edit hosts file at /etc/ansible/hosts.

 root@server01:~# vi /etc/ansible/hosts

Fill it with our server which will be managed like below.

 server2 ansible_host=
 server3 ansible_host=

Check the inventory.

 root@server01:~# ansible-inventory --list -y

The result will be like below.

          ansible_python_interpreter: /usr/bin/python3
          ansible_python_interpreter: /usr/bin/python3
    ungrouped: {}

Step 3 - Test The Connection

From server01, we can run this to ping test to server02 and server03.

 root@server01:~# ansible all -m ping -u root

The output should be like this.

server2 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
server3 | SUCCESS => {
    "changed": false, 
    "ping": "pong"