HCL-TECH-SOFTWARE / connections-automation

Deployment and upgrade automation scripts for HCL Connections 7.0 based on Ansible

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set Python3 as Ansible Python Interpreter (on controller) ?

MagnaFrisia90 opened this issue · comments

Hello,

in #262 we discussed issue that could be solved by using Python3 instead of Python2 as Ansible-Python-Interpreter. e.g. by setting "interpreter_python" in "ansible.cfg" (/etc/ansible or /connections-automation/ansible.cfg).
But this does not work for a CentOS7 envoirnment.

How can I switch to Python3 for Ansible ?

ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Jun 28 2022, 15:30:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

[root@srv906 ansible]# cat /etc/ansible/ansible.cfg

[defaults]

interpreter_python = /usr/lib/python3.6

@sabrina-yee Any idea ? I think I managed to apply Python3 to Ansible by using "pip3 install ansible". But this does not work for me now on another node. I would really appreciate it if you could find a clear path on how to configure Python3 for Ansible on CentOS7

I think "interpreter_python" only controls target-host python for ansible. But not controller-node ansible.

Thanks in advance.

Regards,
Jan

This is more an ansible question but I'll comment as an individual public repo contributor not specific to this project.
In searching about this topic there are several way to do it. I just tried the steps in this link up till the "ansible --version" step in a new CentOS7 VM and got the same result per the instructions.

Hope this helps.

I will use pip to install Ansible next time. I did not manage to setup the virtualenv but it should also work.
In this specific case I move to k3s from HCL-k8s deployment to avoid this problem.