In this article, We are going to learn how to install Ansible on Ubuntu. Ansible is a powerful automation and remote management tool that allows you to administer all your remote machines. It is cross-platform and can work on most machines with no requirements for additional software and also offers security by utilizing SSH and Python on remote machines to execute specified tasks.

It supports two methods for managing remote machines:

  • Ad hoc commands:
  • This is the most common method of managing remote machines. You can execute commands on remote machines without any additional software.

  • Ansible Playbooks:
  • This is a more advanced method of managing remote machines. You can execute commands on remote machines using Ansible Playbooks.

    Pre-requisites

  • Ubuntu or a Debian-based distribution – This is the machine we use to connect to the remote machines using SSH.
  • Once you have both of the above requirements met, we can begin.

    Install Ansible on Debian/Ubuntu

    Before, we install Ansible on Ubuntu we need to update our packages. To do this, we use the following command:

    1
    2
    sudo apt-get update
    sudo apt-get dist-upgrade -y

    Now, we can install Ansible using the following command:

    1
    2
    3
    sudo apt install software-properties-common
    sudo add-apt-repository --yes --update ppa:ansible/ansible
    sudo apt install ansible -y

    Check Ansible is installed

    To check is Ansible is installed, we can use the following command:

    1
    ansible --version

    What's Next?

    In next article, we will learn how to use Ansible to deploy our application on remote machines.

    Conclusion

    If you have any issue regarding this post, mention your issue in comment section or reach me through my E-mail.

    Happy Coding