Table of Contents

2 ways to check ansible version in Linux

If you are a Linux user who is using Ansible to manage your systems, you may want to know how to check the Ansible version. In this blog post, we will show you two ways to do that. The first way is to use the ansible –version command, and the second way is to use the ansible-playbook –version command. We will also show you how to find out what version of Ansible your system is currently running.

Check ansible version with ansible command in Linux

The easiest way to check ansible version is using ansible –version command. Simply type it into your terminal:$ ansible –version. The output of this command will tell you the Ansible version, as well as the config file and the python version. If you want to know more about a particular Ansible command, you can use the –help flag with that command.

You should see output similar to this:
ansible X.X.X config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides python version = X.X.X (default, Apr 16 YYYY, 01:01:01) [GCC XX]

Check ansible version with ansible-playbook command in Linux

To check the Ansible version using the ansible-playbook –version command, simply type it into your terminal:$ ansible-playbook –version

You should see output similar to this:
ansible-playbook X.X.X
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = X.X.X (default, Apr 16 YYYY, 01:01:01) [GCC XX]

For example, to learn more about the ansible-playbook command, you would type the following into your terminal: $ ansible-playbook –help

Check ansible location with find command in Linux

If you want to find out where Ansible is installed on your system, you can use the find command. To do that, type the following into your terminal: $ find / -name ansible.

This will search through all of the directories on your system for a file named ansible. If Ansible is installed in a directory other than the default location (which is usually /usr/local/bin), the find command will tell you where it is.You should see output similar to this: /usr/local/bin/ansible

FAQ about ansible version

Q: How to upgrade to the latest Ansible version?

A: To upgrade to the latest Ansible version, you can use either the pip or dnf command. To upgrade using pip, type the following into your terminal: $ pip install –upgrade ansible. To upgrade using dnf, type the following into your terminal: $ dnf upgrade Ansible

Q: I am trying to check the version of a particular module/playbook/role. How can I do that?

A: To check the version of a particular module, playbook, or role, you can use the ansible-doc -M command. For example, to check the version of the yum module, you would type the following into your terminal: $ ansible-doc -M /usr/share/ansible/modules/yum yum_module

You might also like