I am running CentOS7. I have installed dnfand updated the default version on Centos to python3. I have added the ansible_python_interpreter=/bin/python3 on the inventory. Still when I run ansible -- version it still says python2.7. I have also done a yum erase ansible and then a dnfinstall ansible. Finally I uninstalled ansible and installed it via pip3 install ansible. Even after doing all this my version of python is still 2.7. What am I missing to get ansible to use python3 as it's default version?
Follow the steps here which instruct on how to configure the python interpreter with the following variable:
ansible_python_interpreter=/usr/bin/python3
If you're using AWX you can create a group in your inventory which represents your python 3 hosts and set the variable at the group level. Or you can do it in global vars, or in the playbooks themselves.
There's some prerequisite work to do to enable python 3 in ansible. It's covered in the doc linked above.
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