Skip to content

How to install Ansible on Ubuntu 22.04

How to use different Ansible variables with examples

Reading Time: 3 minutes

This tutorial will guide you on How to install Ansible on Ubuntu 22.04. Ansible is Open source command line tool that can be used in IT automation software. Ansible is written in Python.

Ansible is simple to use and its main focus is on security. It uses OpenSSH for transport. Users can use Ansible without a lot of training however basic training is required.

Ansible is an agentless automation tool that you install on a single host and this is also referred to as the control node. From the control node, Ansible can manage multiple fleets of machines and other hosts/devices and these are also referred to as managed nodes, remotely with SSH, Powershell remoting, and numerous other transports, all from a simple command-line interface with no databases or daemons required.

Learn how to install Ansible on Ubuntu 22.04, a powerful open-source IT automation tool. Ansible simplifies complex tasks, emphasizing security with its agentless architecture. This tutorial guides you through installation steps and explores Ansible’s usage, empowering you to manage multiple systems seamlessly.

Master Ansible installation on Ubuntu 22.04 and discover its capabilities in IT automation. Verify installation, check OS version, and grasp fundamental Ansible commands. This guide ensures a solid foundation for harnessing Ansible’s potential.

Table of Contents

Check Ansible Version

  • $ ansible –version
    • This command will confirm if Ansible is already installed or not.
Check OS version
  • $ cat /etc/os-release

How to install Ansible on Ubuntu 22.04

  • $ sudo apt-get install ansible
  • Validate :
  • $ dpkg –list |grep -i ansible
  • Finally, check version
    $ ansible –version
    You can also run $ ansible command.

If you have followed the above steps then you should be able to install ansible on the ubuntu system however if you get any errors I suggest you follow again so you can first learn and implement How to install Ansible on Ubuntu 22.04

Complete Video Tutorial

Ansible Usages

adminuser@testertechie:~$ ansible

usage: ansible [-h] [–version] [-v] [-b] [–become-method BECOME_METHOD]

           [--become-user BECOME_USER] [-K] [-i INVENTORY] [--list-hosts]

           [-l SUBSET] [-P POLL_INTERVAL] [-B SECONDS] [-o] [-t TREE]

           [-k] [--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER]

           [-c CONNECTION] [-T TIMEOUT]

           [--ssh-common-args SSH_COMMON_ARGS]

           [--sftp-extra-args SFTP_EXTRA_ARGS]

           [--scp-extra-args SCP_EXTRA_ARGS]

           [--ssh-extra-args SSH_EXTRA_ARGS] [-C] [--syntax-check] [-D]

           [-e EXTRA_VARS] [--vault-id VAULT_IDS]

           [--ask-vault-password | --vault-password-file VAULT_PASSWORD_FILES]

           [-f FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR]

           [-a MODULE_ARGS] [-m MODULE_NAME]


Detailed usages options:

–ask-vault-password, –ask-vault-pass
ask for the vault password
–list-hosts outputs a list of matching hosts; does not execute
anything else
–playbook-dir BASEDIR
Since this tool does not use playbooks, use this as a
substitute playbook directory. This sets the relative
path for many features including roles/ group_vars/
–syntax-check perform a syntax check on the playbook but do not
execute it
–vault-id VAULT_IDS the vault identity to use
–vault-password-file VAULT_PASSWORD_FILES, –vault-pass-file VAULT_PASSWORD_FILES
vault password file
–version shows program’s version number, config file location,
configured module search path, module location,
executable location and exit
-B SECONDS, –background SECONDS
run asynchronously, failing after X seconds
-C, –check don’t make any changes; instead, try to predict some
of the changes that may occur
-D, –diff when changing (small) files and templates, show the
differences in those files; works great with –check
prepend colon-separated path(s) to module library (de
set the poll interval if using -B (default=15)
module arguments
-e EXTRA_VARS, –extra-vars EXTRA_VARS
set additional variables as key=value or YAML/JSON,
if the filename is prepend with @
-f FORKS, –forks FORKS
specify the number of parallel processes to use
-h, –help show this help message and exit
-i INVENTORY, –inventory INVENTORY, –inventory-file INVENTORY
specify inventory host path or comma separated host
list. –inventory-file is deprecated
-l SUBSET, –limit SUBSET
further limit selected hosts to an additional pattern
-m MODULE_NAME, –module-name MODULE_NAME
module name to execute (default=command)
-o, –one-line condense output
-t TREE, –tree TREE log output to this directory
-v, –verbose verbose mode (-vvv for more, -vvvv to enable
connection debugging)

Question: How to install Ansible on Ubuntu 22.04?

Answer: Execute the following commands:

$ sudo apt-get install ansible

$ dpkg –list |grep -i ansible $ ansible –version

Ensure successful installation by validating the Ansible version. This tutorial empowers users to install and utilize Ansible, simplifying complex IT automation tasks on Ubuntu 22.04.

You can find Linux Tutorials on this page

You can also find all Video Tutorial on Youtube


We hope you have learned How to install Ansible on Ubuntu 22.04 and how to use Ansible. If you have any questions on How to install Ansible on Ubuntu 22.04, Please comment or write us & we will try to reply ASAP.

You can read more on “How to use ansible

Please follow the tutorial “How to create Ansible Inventory

Please follow the tutorial “How to use ansible adhoc command

You can find the official Ansible installation guide here

Follow us on Facebook Twitter X Reddit Quora Linkedin Tubmblr Youtube


Leave a Reply

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