how to choose a python interpreter for Ansible playbook?


I have python2.7 and python3.5 in my ansible server , while executing playbooks it is using python2.7. I wanted ansible to use python3.5 when executing playbooks.

But still, ansible is not running python3.


If you want to set the Python interpreter for individual hosts and groups, set the ansible_python_interpreter inventory variable.

If however, you want to set the Python interpreter for global use, then set the interpreter_python key in the [defaults] section in the configuration file ansible.cfg.

For a complete list of possible values for the two options above, please see:

Also see this example for usage of ansible_python_interpreter: , section “Testing Python 3 module support”.

Leave a Reply