Ansible Pilot

How to install Ansible in Ubuntu 24.04 LTS Noble Numbat— Ansible install

How to install ansible using the universe repository in Ubuntu 24.04 LTS Noble Numbat.

April 22, 2024
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons


In the rapidly evolving landscape of IT infrastructure management, Ansible emerges as a beacon of efficiency and simplicity. This open-source tool, championed by Red Hat, automates complex IT tasks and provides a user-friendly interface that simplifies the process of managing large-scale systems. This article delves into the practical application of Ansible in managing Ubuntu systems, using a real-world session log to illustrate its integration and efficacy.

The integration of Ansible into Ubuntu systems provides significant security benefits. By automating the patch management process, Ansible ensures that all systems are up-to-date with the latest security patches, reducing the risk of vulnerabilities. Additionally, Ansible’s agentless architecture minimizes the system’s attack surface, as it does not require additional software installed on the client machines.


Here is a step-by-step guide to securely connect to an Ubuntu 24.04 server and install Ansible for automation tasks:

Step 1: Establishing SSH Connection

  1. Open Terminal: Start by opening your terminal on your local machine.
  2. Connect via SSH: Use the SSH command to initiate a secure connection:
  1. Replace devops with your actual username and with your server’s hostname or IP address.
  2. Verify Host Authenticity: Upon first connection, you’ll be asked to verify the host’s fingerprint:

The authenticity of host ‘ (’ can’t be established.
ED25519 key fingerprint is SHA256:WJG2h7cUirgFb3aXxeQkwvUJfE76ea21+U3mTD23tOQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

  1. Type yes to continue if you recognize the fingerprint.
  2. Enter Password: Input your user password when prompted to establish the connection.

Step 2: Initial Server Setup and Updates

  1. Check for Updates: Once connected, check for available updates:
sudo apt update
  1. This command updates the list of packages and their versions on your server but doesn’t install them.
  2. Upgrade Packages: Optionally, you can upgrade all your system software to the latest available versions:
sudo apt upgrade
  1. Confirm the prompt with y to proceed with the upgrades.

Step 3: Installing Ansible

  1. Install Ansible: After updating your system, install Ansible using:
sudo apt install ansible
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  ansible-core python3-argcomplete python3-dnspython python3-jmespath python3-kerberos\
  python3-libcloud python3-lockfile python3-ntlm-auth python3-packaging python3-passlib\
  python3-requests-ntlm python3-resolvelib python3-selinux python3-simplejson\
  python3-winrm python3-xmltodict
Suggested packages:
  cowsay sshpass python3-trio python3-aioquic python3-h2 python3-httpx python3-httpcore\
The following NEW packages will be installed:
  ansible ansible-core python3-argcomplete python3-dnspython python3-jmespath
  python3-kerberos python3-libcloud python3-lockfile python3-ntlm-auth
  python3-packaging python3-passlib python3-requests-ntlm python3-resolvelib
  python3-selinux python3-simplejson python3-winrm python3-xmltodict
0 upgraded, 17 newly installed, 0 to remove and 67 not upgraded.
Need to get 19.6 MB of archives.
After this operation, 316 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
  1. This command installs Ansible along with its dependencies. Confirm the installation by typing y when prompted.
  2. Verify Installation: Check the installed version of Ansible to ensure it is correctly installed:
ansible --version
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
  1. This will display the version and configuration details of Ansible.

Step 4: Configuring Ansible (Optional)

  1. You can generate the default configuration file using the command:
ansible-config init --disabled > ansible.cfg
  1. Configure Ansible: You can modify Ansible’s configuration settings by editing its configuration file:
sudo nano /etc/ansible/ansible.cfg
  1. Make necessary changes such as default inventory file, privilege escalation settings, etc., according to your requirements.
  2. Create Inventory File: Ansible uses an inventory file to keep track of the servers it manages. Create a new inventory:
sudo nano /etc/ansible/hosts
  1. Add your servers under appropriate groups for better organization.
localhost ansible_connection=local

The Best Resources For Ansible


Video Course

Printed Book


Step 5: Testing Ansible Connection

  1. Test Connection: Run a simple Ansible command to check if Ansible can connect to the servers listed in your inventory file:
ansible all -m ping
  1. This command tests connectivity to all hosts in your inventory using the ping module. This is the expected output:
localhost | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    "changed": false,
    "ping": "pong"

Additional Tips

By following these steps, you’ll have a secure and functional setup for managing and automating tasks on your Ubuntu 24.04 server using Ansible. This setup provides a robust foundation for scaling your infrastructure management tasks efficiently.


The use of Ansible in managing Ubuntu systems exemplifies the transformative impact of automation in IT operations. The session log provides a concrete example of how Ansible can be integrated into existing workflows to enhance efficiency, security, and manageability. As IT environments continue to grow in complexity, the role of automation tools like Ansible becomes increasingly critical. By embracing these tools, organizations can significantly reduce operational overheads and enhance their ability to respond swiftly to changing technological landscapes.

In summary, the practical application of Ansible in Ubuntu systems not only streamlines operations but also fortifies them against security threats, proving itself as an indispensable tool for modern IT infrastructure management.

Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.


Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases