Is there any way to run different playbooks in the same directory with different ansible versions using the ansible-playbook command?
Can you please elaborate more on this?
The keyword you are looking into is python virtualenv.
Regards,
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.
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.
Then it's just a matter of changing your environment's PATH setup and
make sure a custom 'ansible-playbook' is picked up first.