Low Orbit Flux Logo 2 F

Ansible - Installation

Ansible is installed on the control node but does not need to be installed on the managed nodes. The managed nodes do need Python and SSH access. Most systems should have this by default.

Two different options:

NOTE

Another tool:

Prerequisites ( prob out of date by the time you read this, just get the latest )::

NOTE - Might need to install sshpass before you can prompt for SSH passwords:



sudo apt install sshpass

Check what version you have after in stallation:



ansible --version

Package Manager Install ( easy way )

Install on Red Hat systems:



sudo dnf install ansible   # Fedora
sudo yum install ansible   # RHEL ( older versions )

On current Debian / Ubuntu systems:



sudo apt update && sudo apt install -y ansible

Ubuntu installation ( might not be needed anymore no newer versions )::



sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible

Install on Arch Linux:



pacman -S ansible

Pip Install

Install using Pip (or pip3 or pipx ):



pip install ansible

Github - Install Latest Version

Install Ansible core from github:



git clone https://github.com/ansible/ansible.git
git clone -b stable-2.17 https://github.com/ansible/ansible.git
cd ./ansible
source ./hacking/env-setup
source ./hacking/env-setup.fish

Python on Managed Nodes

Mosts hosts probably have Python installed already and it should be a new enough version unless it is very old. If you don’t have Python installed on your remote hosts for whatever reason, you won’t be able to run most ansible modules against those hosts. You can still run the raw module because that doesn’t need Python. Use that to install Python as shown here.

Use raw mode to install python:



ansible myhost --become -k -K -m raw -a "yum install -y python3"
ansible myhost --become -k -K -m raw -a "yum install -y python3"