Ansible Curriculum
Install Linux
Linux systems are the most common platforms for Ansible control nodes. While you can install Ansible using Python's package manager, installing it using your operating system's native package manager is convenient because it handles system-level dependencies (such as the OpenSSH client) automatically.
In this guide, we will cover how to install Ansible on Debian/Ubuntu systems, enable repositories and install on Red Hat Enterprise Linux (RHEL)/CentOS systems, verify the installation, and analyze the output of the configuration path variables.
Installation Commands Summary
1. Installing on Ubuntu and Debian
Ubuntu maintains a dedicated Personal Package Archive (PPA) to distribute the latest stable versions of Ansible.
Ubuntu Installation:
2. Installing on CentOS and Red Hat Enterprise Linux (RHEL)
RHEL 8 / 9 Installation:
On Red Hat Enterprise Linux, the Ansible packages are distributed through official subscription repositories. You must enable the correct repository before running the installation command.
CentOS 7 / 8 Installation:
CentOS uses the EPEL (Extra Packages for Enterprise Linux) repository to host Ansible packages.
3. Verifying the Installation
After the installation completes, verify that the binary is available and configuration paths are resolved correctly by running:
Output:
Verify these key parameters in the output:
config file: The active configuration file (defaults to/etc/ansible/ansible.cfgunless overridden).executable location: The path to the Ansible binary (confirm it points to the expected system directory).python version: The Python interpreter version used by the control node.
Summary
Ansible can be installed on Linux using native package managers like apt or dnf. By adding the official repositories, you can install the latest stable version and verify your installation using the ansible --version command. In the next section, we will cover installing Ansible on macOS.