# Running ansible playbook with different versions

**URL:** <https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638>\
**Category:** Ansible Project\
**Created:** [November 12, 2019, 6:20am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638 "2019-11-12T06:20:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ganesh\_Biradar](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@Ganesh\_Biradar](https://forum.ansible.com/u/Ganesh_Biradar)\
**Post date:** [November 12, 2019, 6:20am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638/1 "2019-11-12T06:20:44Z")

</div>

Is there any way to run different playbooks in the same directory with different ansible versions using the ansible-playbook command?

---

<div class="post-metadata">

**Author:** ![soumya\_dutta](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@soumya\_dutta](https://forum.ansible.com/u/soumya_dutta)\
**Post date:** [November 12, 2019, 6:31am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638/2 "2019-11-12T06:31:45Z")

</div>

Can you please elaborate more on this?

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [November 12, 2019, 6:41am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638/3 "2019-11-12T06:41:38Z")

</div>

The keyword you are looking into is python virtualenv.

Regards,

---

<div class="post-metadata">

**Author:** ![Ganesh\_Biradar](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@Ganesh\_Biradar](https://forum.ansible.com/u/Ganesh_Biradar)\
**Post date:** [November 12, 2019, 9:01am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638/4 "2019-11-12T09:01:29Z")

</div>

I have a directory which has different yaml playbooks. These were written using ansible 2.4. I want to write newer playbooks using the latest version. But there is an infrastructure in place which calls these playbooks using ‘ansible-playbook’. I cannot change how the playbook is invoked. I was wondering if I could specify the path of the ansible-playbook to be used in the yaml file itself.

---

<div class="post-metadata">

**Author:** ![Ganesh\_Biradar](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@Ganesh\_Biradar](https://forum.ansible.com/u/Ganesh_Biradar)\
**Post date:** [November 12, 2019, 9:03am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638/5 "2019-11-12T09:03:22Z")

</div>

Yeah I thought about this too, but then I would have to change how the playbooks are invoked. I do not access to do this. Currently the playbooks are executed using ‘ansible-playbook’ command, which is located in ‘/usr/bin/ansilbe-playbook’. Please see my other reply for more information.

---

<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:** [November 12, 2019, 10:06am UTC](https://forum.ansible.com/t/running-ansible-playbook-with-different-versions/31638/6 "2019-11-12T10:06:29Z")

</div>

Then it's just a matter of changing your environment's PATH setup and  
make sure a custom 'ansible-playbook' is picked up first.
