Use-Case:
ansible_python_interpreter=/usr/bin/env python-docker
We connect to the same host/s again, but now we must use the /usr/bin/env python-docker
python interpreter
What is the best way to do this?
Currently we set ansible_python_interpreter
on the playbook level of Playbook 2
:
---
- name: DaqMon app
vars:
- ansible_python_interpreter: "{{ '/usr/bin/env python-docker' }}"
This works, but this will also change the python interpreter of the local actions. And thus the local actions will fail, because (python-docker
does not exist locally).
ansible_python_interpreter
on every local-action which is tedious and error-proneQuestions:
'/usr/bin/env python-docker'
as fallback to interpreter-python-fallback - but I think this is not possibleYou should set the ansible_python_interpreter
on the host level.
So yes, it's possible to explicitly set the interpreter for localhost in your inventory.
localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python
And I assume that you could also use set_fact
on hostvars[<host>].ansible_python_interpreter
on your localhost or docker host.
There is a brillant article about set_fact
on hostvars
! ;-P
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With