How to Install Ansible on Ubuntu 22.04 - Secret Revealed of Offshore Hosting Company | Bulletproof Hosting Directory 2022

How to Install Ansible on Ubuntu 22.04

Set up Ansible on Ubuntu 22.04 and configure it to connect with distant servers to automate a number of duties. Ansible is a configuration administration device which presents an structure that doesn’t require particular software program to be put in on nodes, utilizing SSH to execute the automation duties and YAML recordsdata to outline provisioning particulars.

On this information you’re going to discover ways to set up Ansible on a Ubuntu 22.04 server and configure it to attach with distant servers on Google cloud and AWS situations.


Root entry to your server or consumer entry with sudo privileges

Step 1: Preliminary server setup

Begin by updating the packages to the most recent model accessible.

sudo apt replace
sudo apt improve

Step 2: Set up Ansible

As soon as all packages are up to date you may proceed to put in Ansible.

sudo apt set up ansible

As soon as the set up is accomplished you may examine the Ansible model put in utilizing the next command.

ansible --version

You’ll get an output much like the one beneath.

ansible 2.10.8
  config file = None
  configured module search path = ['/home/pappinvijak/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python model = 3.10.4 (essential, Apr  2 2022, 09:04:19) [GCC 11.2.0]

Step 3: Setup Stock File

The stock file comprises all details about the hosts that you’ll handle with Ansible.

To configure stock file you may open the /and so on/ansible/hosts file and alter the configurations.

sudo nano /and so on/ansible/hosts

Right here you may configure a number of teams and their very own variables.

Supplied a pattern configuration of distant server connection particulars to connect with Google cloud and AWS situations.

gcp_instance_1 ansible_host=EXTERNAL_IP


aws_instance_1 ansible_host=EXTERNAL_IP



Right here we’ve got created two teams google_cloud and aws and there personal corresponding variables with SSH username and the personal keys.

You may examine the stock utilizing the next command.

ansible-inventory --list -y

You’ll obtain and output much like the one beneath with the respective variables within the corresponding group.

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

You could add the general public key to the distant host and configure the personal key to make a profitable connection.

After you have configured all required particulars you may proceed to check the connection.

Step 4: Take a look at Connection

Now Ansible ought to be capable to connect with the servers listed within the stock file utilizing SSH.

To examine connection on all servers you should utilize the next command.

ansible all -m ping

To examine connection on a selected group you should utilize this command

ansible google_cloud -m ping

The ping module will take a look at

  • if hosts are accessible;
  • when you have legitimate SSH credentials;
  • if hosts are in a position to run Ansible modules utilizing Python.

You’ll get an output much like the one beneath.

gcp_instance_1 | SUCCESS => {
  "modified": false,
  "ping": "pong"

If the configuration just isn’t made correctly you’ll get this message.

gcp_instance_1 | UNREACHABLE! => {
  "modified": false,
  "msg": "Failed to connect with the host through ssh: [email protected]: Permission denied (publickey).",
  "unreachable": true

In case you have any connection issues it is advisable present correct SSH credentials and be sure you can join utilizing that credentials.


Now you have got realized the right way to set up Ansible on Ubuntu 22.04 and configure it to connect with distant servers on Google cloud and AWS.

Thanks in your time. In case you face any drawback or any suggestions, please go away a remark beneath.

offshore vps
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker. We use only Banner Ads (No Pop Ads)

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock