1. Install

1.1. Requirements

  • Can be run from any machine with Python 2.7, Python 3.5 or higher

  • Windows is not supported for the control node

  • Some modules and plugins have additional requirements

1.2. Installation

1.2.1. PIP

  • Preferred way

$ pip3 install ansible

1.2.2. Alpine

Code 1.21. 175MB
$ apk add --no-cache ansible
Code 1.22. 337MB
$ apk add --no-cache python3 python3-dev gcc musl-dev libffi-dev openssl-dev
$ pip3 --no-cache-dir install ansible

1.2.3. Ubuntu

Code 1.23. Install version provided by Ubuntu (older)
$ apt install ansible
Code 1.24. Install version provided by Ansible (newer)
$ apt update
$ apt install software-properties-common
$ apt-add-repository --yes --update ppa:ansible/ansible
$ apt install ansible

1.2.4. Debian

$ echo 'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' > /etc/apt/sources.list.d/ansible
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
$ apt update
$ apt install ansible

1.3. Client Dependencies

  • Ansible modules depends on Python 3 installed on machine

  • Ansible’s raw module, and the script module, do not depend on a client side install of Python to run

  • You can use Ansible to install a compatible version of Python using the raw module, which then allows you to use everything else

$ ansible myhost --become -m raw -a 'apt install -y python3'