You are on page 1of 3

Ansible is an agentless automation tool that you install on a control node.

From the control


node, Ansible manages machines and other devices remotely (by default, over the SSH
protocol).

To install Ansible for use at the command line, simply install the Ansible package on one
machine (which could easily be a laptop). You do not need to install a database or run any
daemons. Ansible can manage an entire fleet of remote machines from that one control node.

 Prerequisites
o Control node requirements
o Managed node requirements
 Selecting an Ansible artifact and version to install
o Installing the Ansible community package
o Installing ansible-core
 Installing and upgrading Ansible with pip
o Prerequisites: Installing pip
o Installing Ansible with pip
o Installing Ansible in a virtual environment with pip
o Upgrading Ansible with pip
 Upgrading from 2.9 or earlier to 2.10
 Upgrading from Ansible 3 or ansible-core 2.10
 Installing Ansible on specific operating systems
o Installing Ansible on RHEL, CentOS, or Fedora
o Installing Ansible on Ubuntu
o Installing Ansible on Debian
o Installing Ansible on Gentoo with portage
o Installing Ansible on FreeBSD
o Installing Ansible on macOS
o Installing Ansible on Solaris
o Installing Ansible on Arch Linux
o Installing Ansible on Slackware Linux
o Installing Ansible on Clear Linux
 Installing and running the devel branch from source
o Installing devel from GitHub with pip
o Installing devel from GitHub by cloning
o Running the devel branch from a clone
 Confirming your installation
 Finding tarballs of tagged releases
 Adding Ansible command shell completion
o Installing argcomplete on RHEL, CentOS, or Fedora
o Installing argcomplete with apt
o Installing argcomplete with pip
o Configuring argcomplete
 Global configuration
 Per command configuration
 Using argcomplete with zsh or tcsh

Prerequisites
Before you install Ansible, review the requirements for a control node. Before you use
Ansible, review the requirements for managed nodes (those end devices you want to
automate). Control nodes and managed nodes have different minimum requirements.

Control node requirements

For your control node (the machine that runs Ansible), you can use any machine with Python
2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. ansible-core 2.11 and Ansible
4.0.0 will make Python 3.8 a soft dependency for the control node, but will function with the
aforementioned requirements. ansible-core 2.12 and Ansible 5.0.0 will require Python 3.8 or
newer to function on the control node. Starting with ansible-core 2.11, the project will only
be packaged for Python 3.8 and newer. This includes Red Hat, Debian, CentOS, macOS, any
of the BSDs, and so on. Windows is not supported for the control node, read more about this
in Matt Davis’s blog post.

Warning

Please note that some plugins that run on the control node have additional requirements.
These requirements should be listed in the plugin documentation.

When choosing a control node, remember that any management system benefits from being
run near the machines being managed. If you are using Ansible to manage machines in a
cloud, consider using a machine inside that cloud as your control node. In most cases Ansible
will perform better from a machine on the cloud than from a machine on the open Internet.

Warning

Ansible 2.11 will make Python 3.8 a soft dependency for the control node, but will function
with the aforementioned requirements. Ansible 2.12 will require Python 3.8 or newer to
function on the control node. Starting with Ansible 2.11, the project will only be packaged for
Python 3.8 and newer.

Managed node requirements

Although you do not need a daemon on your managed nodes, you do need a way for Ansible
to communicate with them. For most managed nodes, Ansible makes a connection over SSH
and transfers modules using SFTP. If SSH works but SFTP is not available on some of your
managed nodes, you can switch to SCP in ansible.cfg. For any machine or device that can run
Python, you also need Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later).

Warning

Please note that some modules have additional requirements that need to be satisfied on the
‘target’ machine (the managed node). These requirements should be listed in the module
documentation.

Note

 If you have SELinux enabled on remote nodes, you will also want to install
libselinux-python on them before using any copy/file/template related functions in
Ansible. You can use the yum module or dnf module in Ansible to install this package
on remote systems that do not have it.
 By default, before the first Python module in a playbook runs on a host, Ansible
attempts to discover a suitable Python interpreter on that host. You can override the
discovery behavior by setting the ansible_python_interpreter inventory variable to a
specific interpreter, and in other ways. See Interpreter Discovery for details.
 Ansible’s raw module, and the script module, do not depend on a client side install of
Python to run. Technically, you can use Ansible to install a compatible version of
Python using the raw module, which then allows you to use everything else. For
example, if you need to bootstrap Python 2 onto a RHEL-based system, you can
install it as follows:
 $ ansible myhost --become -m raw -a "yum install -y python2"

You might also like