Prerequisites
- Linux OS - The system that Ansible is installed on is known as the control node. Windows is not supported for the control node. Instead, Ansible must be installed on a Linux distribution.
- Python - The control node must have Python version 2.7 or higher or Python version 3.5 or higher installed. The python --version command can be used to determine if Python is installed and the version that is installed. If Python is not installed, the installation of Ansible will also install Python.
Install
The pip3 --version can be used to determine if pip3 is installed. If pip3 is installed, something like this should be displayed. If pip3 is not installed, refer to Installing PIP on Linux CentOS.
AVOID TROUBLE
There are 3 versions of pip
- pip is used for Python version 2.6 and below
- pip2 is used for Python version 2.7 and above
- pip3 is used for Python version 3
For example, the /usr/bin/pip command (or just pip) would be used for Python version 2.6 and below.
pip3 --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
The hash command caches the paths to commands, and if a command is relocated then bash will not pick it up unless that cache is cleared. Issue the following command to clear Ansible from the cache.
hash -d ansible-lint
Use pip3 to install ansible.
pip3 install ansible-lint
The pip3 list command can be used to ensure that Ansible was installed. In this example, Ansible version 2.9.12 is installed.
pip3 show ansible-lint
Name: ansible-lint
Version: 4.3.1
Summary: Checks playbooks for practices and behaviour that could potentially be improved
Home-page: https://github.com/ansible/ansible-lint
Author: Will Thames
Author-email: will@thames.id.au
License: MIT
Location: /usr/lib/python3.6/site-packages
Requires: pyyaml, typing-extensions, ruamel.yaml, ansible, rich
Likewise, the ansible-lint --version command will display the version of ansible-lint that was installed.
~]# ansible-lint --version
ansible-lint 4.3.1
Did you find this article helpful?
If so, consider buying me a coffee over at