Nvidia Unveils Futuristic Gaming Experience at Computex 2023
News

Nvidia Unveils Futuristic Gaming Experience at Computex 2023, Blending Gaming and AI

by Isabel
May 29, 2023
0

At Computex 2023, Nvidia displays a futuristic gaming experience that...

Read more
Adobe Introduces Powerful Generative AI Tools in Photoshop

Adobe Introduces Powerful Generative AI Tools in Photoshop Beta

May 29, 2023
Adobe Photoshop's Generative Fill Feature

Exploring the Power of Adobe Photoshop’s Generative Fill Feature

May 27, 2023
NVIDIA and Microsoft Partner to Accelerate AI

NVIDIA and Microsoft Partner to Accelerate AI

May 25, 2023
google photos security and privacy

Exploring the Top 5 Privacy and Security Risks of using Google Photos

May 24, 2023
How to Upload a Document to ChatGPT

How to Upload a Document to ChatGPT

May 25, 2023
Top 5 Data Science Courses in 2023 for Better Job Opportunities

Top 5 Data Science Courses in 2023 for Better Job Opportunities

March 1, 2023
ChatGPT Cheat sheet for Frontend Designer

Ultimate ChatGPT cheatsheet for frontend Designers

May 10, 2023
ChatGPT login

ChatGPT Login Guide to Free OpenAI Access

May 20, 2023
Turn Text into Music with MusicLM

Turn Text into Music with MusicLM

May 16, 2023
ChatGPT Plugins concepts and use cases

ChatGPT Plugins: Concepts and Use Cases

April 28, 2023
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How to Install Ansible on Ubuntu 22.04

by Cloudbooklet
May 19, 2023
in Google Cloud, Compute Engine
Reading Time: 5 mins read
How to Install Ansible on Ubuntu 22.04
Share on FacebookShare on TwitterShare on WhatsAppShare on Telegram

Install Ansible on Ubuntu 22.04 and configure it to connect to remote servers to automate several tasks. Ansible is a configuration management tool which offers an architecture that doesn’t require special software to be installed on nodes, using SSH to execute the automation tasks and YAML files to define provisioning details.

In this guide you are going to learn how to install Ansible on a Ubuntu 22.04 server and configure it to connect with remote servers on Google cloud and AWS instances.

You might also like

How to Setup SSH Keys on Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

May 31, 2023
DragGAN AI editing Tool Install and Use DragGAN Photo Editor

DragGAN AI editing Tool Install and Use DragGAN Photo Editor

May 27, 2023

Prerequisites

Root access to your server or user access with sudo privileges

Step 1: Initial server setup

Start by updating the packages to the latest version available.

sudo apt update
sudo apt upgrade

Step 2: Install Ansible

Once all packages are updated you can proceed to install Ansible.

sudo apt install ansible

Once the installation is completed you can check the Ansible version installed using the following command.

ansible --version

You will get an output similar to the one below.

Output
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 version = 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]

Step 3: Setup Inventory File

The inventory file contains all information about the hosts that you will manage with Ansible.

To configure inventory file you can open the /etc/ansible/hosts file and adjust the configurations.

sudo nano /etc/ansible/hosts

Here you can configure multiple groups and their own variables.

Provided a sample configuration of remote server connection details to connect to Google cloud and AWS instances.

[google_cloud]
gcp_instance_1 ansible_host=EXTERNAL_IP

[google_cloud:vars]
ansible_ssh_user=username
ansible_ssh_private_key_file=path_to_private-key

[aws]
aws_instance_1 ansible_host=EXTERNAL_IP

[aws:vars]
ansible_ssh_user=username
ansible_ssh_private_key_file=path_to_private-key-or-pem-key

[all:vars]
ansible_python_interpreter=/usr/bin/python3

Here we have created two groups google_cloud and aws and there own corresponding variables with SSH username and the private keys.

You can check the inventory using the following command.

ansible-inventory --list -y

You will receive and output similar to the one below with the respective variables in the corresponding group.

Output
all:
  children:
    google_cloud:
      hosts:
        gcp_instance_1:
          ansible_host: EXTERNAL_IP
          ansible_python_interpreter: /usr/bin/python3
          ansible_ssh_user=username
          ansible_ssh_private_key_file=path_to_private-key
    aws:
      hosts:
        aws_instance_1:
          ansible_host: EXTERNAL_IP
          ansible_python_interpreter: /usr/bin/python3
          ansible_ssh_user=username
          ansible_ssh_private_key_file=path_to_private-key-or-pem-key
  ungrouped: {}

You need to add the public key to the remote host and configure the private key to make a successful connection.

Once you have configured all required details you can proceed to test the connection.

Step 4: Test Connection

Now Ansible should be able to connect to the servers listed in the inventory file using SSH.

To check connection on all servers you can use the following command.

ansible all -m ping

To check connection on a specific group you can use this command

ansible google_cloud -m ping

The ping module will test

  • if hosts are accessible;
  • if you have valid SSH credentials;
  • if hosts are able to run Ansible modules using Python.

You will get an output similar to the one below.

Output
gcp_instance_1 | SUCCESS => {
  "changed": false,
  "ping": "pong"
}

If the configuration is not made properly you will get this message.

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

If you have any connection problems you need to provide proper SSH credentials and make sure you can connect using that credentials.

Conclusion

Now you have learned how to install Ansible on Ubuntu 22.04 and configure it to connect to remote servers on Google cloud and AWS.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: AnsibleUbuntu 22.04
Share3Tweet2SendShare
Cloudbooklet

Cloudbooklet

Help us grow and support our blog! Your contribution can make a real difference in providing valuable content to our readers. Join us in our journey by supporting our blog today!
Buy me a Coffee

Related Posts

Set Up Deep Learning with Nvidia, Cuda, cuDNN on Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

May 27, 2023
How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

April 13, 2023
How to Change Timezone on Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

May 16, 2023
How to Install PHP-FPM with Apache on Ubuntu 22.04

How to Install PHP-FPM with Apache on Ubuntu 22.04

May 19, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

  • Trending
  • Comments
  • Latest
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

May 30, 2023
DragGAN AI editing Tool Install and Use DragGAN Photo Editor

DragGAN AI editing Tool Install and Use DragGAN Photo Editor

May 27, 2023
Bard API key

Everything You Need to Know About Google’s Bard API Key

May 20, 2023
Install PHP 8.1 on Ubuntu

How to Install or Upgrade PHP 8.1 on Ubuntu 20.04

May 17, 2023
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

75
Upgrade PHP version to PHP 7.4 on Ubuntu

Upgrade PHP version to PHP 7.4 on Ubuntu

28
Install Odoo 13 on Ubuntu 18.04 with Nginx - Google Cloud

Install Odoo 13 on Ubuntu 18.04 with Nginx – Google Cloud

25
Best Performance WordPress with Google Cloud CDN and Load Balancing

Best Performance WordPress with Google Cloud CDN and Load Balancing

23
How to Setup SSH Keys on Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

May 31, 2023
ChatGPT app

The Easiest Way to Download ChatGPT App Free

May 31, 2023
LLM Connected with APIs

Gorilla: LLM Connected with APIs

May 31, 2023
Soundstorm-Pytorch

Soundstorm-Pytorch: A Powerful Tool for Audio Generation

May 30, 2023

Popular Articles

  • DragGAN The AI-Powered Image Editing Tool

    DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

    1437 shares
    Share 575 Tweet 359
  • DragGAN AI editing Tool Install and Use DragGAN Photo Editor

    333 shares
    Share 133 Tweet 83
  • Auto-Photoshop-Stable Diffusion-Plugin: A New Way to Create AI-Generated Images in Photoshop

    70 shares
    Share 28 Tweet 18
  • InternGPT: A New Way to Interact with ChatGPT

    54 shares
    Share 22 Tweet 14
  • Midjourney vs Adobe Firefly: A Comparison of Two AI Image Generation Tools

    10 shares
    Share 4 Tweet 3
Cloudbooklet

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS

Cloudbooklet © 2023 All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.