Problem scenario
You are using Ansible with -vvv to see what Python version it is using. (Or you use ansible --version
.) You see an incorrect version of Python being used.
You tried ansible_python_interpreter=/usr/bin/python3
in your playbook and in the ansible.cfg file. Neither worked.
What should you do?
Solution
In the playbook, find the hosts stanza. Underneath it use this (where python3 is the version you want and "/usr/bin" is the path to it):
vars:
ansible_python_interpreter: /usr/bin/python3