Sobes.tech
Junior

How to properly install Ansible?

sobes.tech AI

Answer from AI

For basic installation of Ansible on most Linux/Unix systems, you can use the package manager:

Debian/Ubuntu:

# Update package list
sudo apt update

# Install Ansible
sudo apt install ansible

Fedora:

# Install Ansible
sudo dnf install ansible -y

CentOS/RHEL:

# Enable EPEL repository (required for Ansible)
sudo yum install epel-release -y

# Install Ansible
sudo yum install ansible -y

For more precise control over the version or installation in an isolated environment, pip is often used:

Python 3:

# Upgrade pip
python3 -m pip install --upgrade pip

# Install Ansible
python3 -m pip install ansible

You can also install from source code, but this is a more complex and less recommended method for most cases.

After installation, you can check the version:

# Check installed Ansible version
ansible --version

To manage remote servers, the control machine must have Ansible installed. Managed nodes by default require OpenSSH Server and Python.

Ensure that the user running Ansible has SSH access rights to the managed nodes and permission to execute commands with necessary privileges (often via sudo).