# Getting ansible (not core) version in the playbook

**URL:** <https://forum.ansible.com/t/getting-ansible-not-core-version-in-the-playbook/35768>\
**Category:** Ansible Project\
**Created:** [September 22, 2021, 8:15am UTC](https://forum.ansible.com/t/getting-ansible-not-core-version-in-the-playbook/35768 "2021-09-22T08:15:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piotr\_Kowalczyk](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@Piotr\_Kowalczyk](https://forum.ansible.com/u/Piotr_Kowalczyk)\
**Post date:** [September 22, 2021, 8:15am UTC](https://forum.ansible.com/t/getting-ansible-not-core-version-in-the-playbook/35768/1 "2021-09-22T08:15:01Z")

</div>

Good morning,

Would you guys help me to understand how to get the Ansible correct version in the playbook?

I have newest Ansible:

(ansible) poe@lime:~$ pip3 freeze | grep ansible  
ansible== **4.6.0**  
ansible-core== **2.11.5**  
(ansible) poe@lime:~$

But `ansible_version` displays core version instead of ansible:

(ansible) poe@lime:~$ ansible localhost -m debug -a ‘var=ansible\_version.full’  
[WARNING]: No inventory was parsed, only implicit localhost is available  
localhost | SUCCESS =\> {  
“ansible\_version.full”: “ **2.11.5** ”  
}

Why is that so?

The same with `ansible --version`:

(ansible) poe@lime:~$ ansible --version | head -1  
ansible [core **2.11.5**]

The only command I’ve found which showing Ansible (not core) version instead is:

(ansible) poe@lime:~$ python -c ‘from ansible\_collections.ansible\_release import ansible\_version; print(ansible\_version)’  
**4.6.0**

So the question is, is this expected? I mean, writing a playbook, I’d like to make sure that Ansible 4.6 is used (or not older). But `ansible_version` returns ansible core version - is something I should rely on instead? What’s going on here? 🙂

Best,  
Piotr Kowalczyk

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 22, 2021, 8:39am UTC](https://forum.ansible.com/t/getting-ansible-not-core-version-in-the-playbook/35768/2 "2021-09-22T08:39:58Z")

</div>

I would use the above command and use the registered output.  
Perhaps ansible would support this natively at some point.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [September 22, 2021, 1:08pm UTC](https://forum.ansible.com/t/getting-ansible-not-core-version-in-the-playbook/35768/3 "2021-09-22T13:08:02Z")

</div>

To date, the decision has been that ansible-core does not discover or know anything about the ansible package. The ansible package just drops collection bundles in a location where ansible-core will look. The only way to get the ansible version is by the means you show, or by calling `pip`.
