How to check Ansible version on Linux/Unix

last updated in Categories ,

How do I check Ansible IT automation tool on my Linux or Unix-like server using the command prompt?

Ansible is a free and open-source automation software that automates software provisioning, configuration management, and application deployment. It is written in Python. It works with SSH and no agent needed on the remote server.

Check Ansible version

Open the terminal Application and type the following command:
$ ansible --version
Sample outputs:

ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/vivek/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

I am using Ansible version 2.4.0.0 along with python version 2.7.14. I strongly suggest that you always use latest stable version.

Build and install latest ansible on RPM based distro

The commands are as follows:
$ git clone https://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm

Install latest ansible on a Ubuntu Linux based distro

Type the following apt-get command:
$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible

Install latest ansible on an Apple macOS X Unix based distro

$ brew install ansible

Install latest version of ansible on a FreeBSD

Type the following pkg command:
# pkg install ansible

Install latest version of ansible on an Arch Linux

Type the following pcman command:
$ sudo pcman -S ansible

Install latest version of ansible on a Debian Linux

Type the following apt command:
# echo 'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' >> /etc/apt/sources.list
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
# apt-get update
# apt-get install ansible

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 0 comments/add one below):