How to Install Ansible on Ubuntu Server Latest

Introduction

Ansible is an open-source automation tool that makes it easier for system administrators and developers to automate IT tasks such as application deployment, OS configuration, and network configuration. This tutorial will cover how to install Ansible on Ubuntu Server.

Prerequisites

Install Ansible on Ubuntu Server

  1. First, we will update the package index on Ubuntu Server using the following command:

    sudo apt update
    
  2. Next, install Ansible by running the following command:

    sudo apt install ansible
    
  3. Once the installation is completed, check the version of Ansible installed on the system by running the following command:

    ansible --version
    

    Output should show the version of Ansible installed.

  4. To run Ansible, create an inventory file using the following command:

    sudo nano /etc/ansible/hosts
    

    The inventory file contains the list of remote hosts on which Ansible is to be run. Add a host to the inventory file in the following format:

    [webserver]
    IP_ADDRESS_OF_REMOTE_HOST
    
    [database]
    IP_ADDRESS_OF_REMOTE_HOST
    

    Save the inventory file by pressing CTRL+X, then Y, and finally ENTER.

  5. Now, we will test if Ansible is working by checking connectivity between the control node and the remote hosts. Run the following command:

    ansible all -m ping
    

    This command will run the "ping" module on all hosts listed in the inventory file. If the command returns a "pong" message for each host, then Ansible is up and running.

Conclusion

After following the steps in this tutorial, we have successfully installed Ansible on Ubuntu Server and verified its connectivity with remote hosts. With Ansible, we can now automate our IT tasks efficiently.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!