Introduction

Ubuntu 24.04.3 LTS provides a stable and reliable platform for running Ansible automation. This guide walks you through installing Ansible on Ubuntu 24.04.3 LTS, ensuring you have everything needed to automate your infrastructure.

Prerequisites

Before you begin, ensure that you have:

  • Access to a Ubuntu 24.04.3 LTS system with root or sudo privileges.
  • An active internet connection to download necessary packages.
  • Python 3.12 or later installed (included by default).

Step-by-Step Installation

1. Connect to Your Server Initiate an SSH connection from your terminal:

``bash

ssh [email protected]

`

2. Switch to Root User For installing system-wide software:

`bash

sudo su

`

3. Update System Packages Before installing any new software, update your system:

`bash

apt update && apt upgrade

`

Confirm any prompts to ensure your system has the latest updates.

4. Install Ansible Using the apt package manager, install Ansible:

`bash

apt install ansible

`

This command installs Ansible along with its dependencies. Confirm the installation when prompted.

5. Verify the Installation Once installation is complete, check the installed version:

`bash

ansible --version

`

This command displays the version of Ansible and configuration details, confirming a successful installation.

Configuration and First Steps

1. Configure Ansible Adjust settings in /etc/ansible/ansible.cfg to customize default inventory file, privilege escalation, and more.

2. Edit the Inventory File Define your managed hosts:

`ini

[local]

localhost ansible_connection=local

[webservers]

web1.example.com

web2.example.com

`

3. Test Ansible Connectivity Ensure Ansible can communicate with your hosts:

`bash

ansible all -m ping

`

Expected output:

`bash

localhost | SUCCESS => {

"ansible_facts": {

"discovered_interpreter_python": "/usr/bin/python3"

},

"changed": false,

"ping": "pong"

}

``

Conclusion

With Ansible installed on Ubuntu 24.04.3 LTS, you are ready to automate your infrastructure. Start by creating simple playbooks and explore the vast library of modules available through Ansible Galaxy.

For more Ansible tutorials and guides, explore the [complete article collection](/articles) on Ansible Pilot.