Ansible is a popular open-source automation tool used for configuration management, application deployment, and orchestration.
If you are a Ubuntu 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 apt command. Let’s get started.
Check ansible version with ansible command in Ubuntu
The best way to check ansible version in Ubuntu 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.
You should see output similar to this:
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
This indicates that Ansible version 2.9.21 is installed, the configuration file is located at /etc/ansible/ansible.cfg, and the Python version being used is 3.8.5.
If you want to know more about a particular Ansible command, you can use the –help flag with that command.
Check ansible version with apt command in Ubuntu
Another way to check the Ansible version is to use the “apt” package manager, assuming you installed Ansible using APT. To check the version of the Ansible package, open a terminal window and enter the following command:
apt show ansible
This command will display detailed information about the Ansible package, including the version number.
In our example, Ansible version 2.9.6+dfsg-1ubuntu0.1 is installed on the system. This command also provides additional information about the package, such as its dependencies, size, maintainer, homepage, and description.
Check ansible location with find command in Ubuntu
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