Ansible expects python 2. On my system (Arch Linux), “python” is Python 3, so I have to pass
-e "ansible_python_interpreter=/usr/bin/python2" with every command.
ansible-playbook my-playbook.yml -e "ansible_python_interpreter=/usr/bin/python2"
Is there a away to set
ansible_python_interpreter globally on my system, so I don’t have to pass it to every command? I don’t want to add it to my playbooks, as not all systems that runs the playbook has a setup similar to mine.
Well you can set in three ways
ansible_python_interpreter=/usr/bin/python2this will set it per host
- Set it host_vars/
ansible_python_interpreter: "/usr/bin/python2"this will set it per host
- set it for all nodes in the file
group_vars/all(you may need to create the directory
group_varsand the file
Hope that helps