I may install python3, create a virtual env and install my ansible-core there then symbol link to the actual os 😂
Sent from my iPhone > On 4 Jul 2023, at 08:45, Nico Kadel-Garcia <[email protected]> wrote: > > On Fri, Jun 30, 2023 at 11:42 AM cool prat <[email protected]> wrote: >> >> Hi @Nico Kadel-Garcia, >> >> Thanks for your detailed reply. >> >> I am trying to understand it. So there is some split and ansible and >> ansible-core is separated now. I can see in the Redhat Downloads (with >> whatever subscription i have) >> the latest package for ansible for RHEL7 is `ansible-2.9.27-1.el7ae`. No >> `ansible-core` i can see for RHEL7. Can see its available for el8, el9. >> >> There is no ansible package for RHEL7 that supports python3? >> >> I have installed python3 on the system but unable to use it for the >> currently installed ansible (2.9.9). >> Because of this (unable to use python3 on controller node) i am getting >> issue in using `kubernetes.core.k8s_info` (as its only support python3 and >> not python2). The error message you can see here - >> https://pastebin.com/zEx6qTXk > > RHEL 7's copy of "ansible" predates the very peculiar split to > "ansible-core", which has most of the old code, and a package called > "ansible" which is dependent on ansible-core, takes up half a Gig of > space, and consists of more than 100 ansible galaxy collection nodes, > and doesn't actually contain ansible. > > Jump to RHEL 8 to install ansible-core of a current release: or > install python3 and python3 -pip, and use this: > > pip3 install ansible-core --user > > i actually publish hooks to build RPMs for recent backports of the > "ansible-core" and "ansible" packages, but I gave on the obsolete RHEL > 7 python 3 a while ago. > > Nico Kadel-Garcia > > >> Can you please tell me, what if i want to do this via .rpm way and not used >> pip for this? >> >> Is using pip install the only way to have python3 support for ansible >> package on controller node on RHEL7 machine? >> >> Thanks, >>> On Friday, June 30, 2023 at 4:41:57 PM UTC+5:30 Nico Kadel-Garcia wrote: >>> >>> On Thu, Jun 29, 2023 at 10:30 AM cool prat <[email protected]> wrote: >>>> >>>> Hi Team, >>>> >>>> I want to use python3 for using k8s module (`kubernetes.core.k8s_info`) on >>>> the ansible controller node which RHEL 7. >>>> >>>> Python2 is already installed. I have installed python3. >>>> >>>> I am trying to use python3 by setting ansible_python_interpreter var but >>>> its still showing that its using python version 2 in the command like >>>> ansible --version. >>>> >>>> >>>> `ansible_python_interpreter` is already set at multiple level and even >>>> after using all the options together, its still not picking up python3 and >>>> giving same error. >>>> >>>> >>>> Have set the var ansible_python_interpreter at i) inventory, ii) playbook, >>>> iii) /home/sac/ansible.cfg and iv) with -e option as well in >>>> ansible-playbook` command. >>>> >>>> i) Added in inventory - >>>> >>>> # ans.ini #localhost ansible_connection=local localhost >>>> ansible_python_interpreter=/opt/rh/rh-python36/root/usr/bin/python3.6 >>>> >>>> ii) added in playbook >>>> >>>> - hosts: localhost connection: local gather_facts: no vars: >>>> ansible_python_interpreter: /opt/rh/rh-python36/root/usr/bin/python3.6 >>>> tasks: . . >>>> >>>> iii) ansible.cfg >>>> >>>> # cat ansible.cfg [defaults] ANSIBLE_PYTHON_INTERPRETER = >>>> /opt/rh/rh-python36/root/usr/bin/python3.6 interpreter_python = >>>> /opt/rh/rh-python36/root/usr/bin/python3.6 ansible_python_interpreter = >>>> /opt/rh/rh-python36/root/usr/bin/python3.6 >>>> >>>> iv) Added as -e in ansible-playbook command, >>>> >>>> ansible-playbook -i ans.ini ans.yml -e >>>> 'ansible_python_interpreter=/opt/rh/rh-python36/root/usr/bin/python3.6' >>>> >>>> Below showing python 2.7.5 >>>> >>>> # ansible --version ansible 2.9.27 config file = /etc/ansible/ansible.cfg >>>> configured module search path = [u'/home/sac/.ansible/plugins/modules', >>>> u'/usr/share/ansible/plugins/modules'] ansible python module location = >>>> /usr/lib/python2.7/site-packages/ansible executable location = >>>> /bin/ansible python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC >>>> 4.8.5 20150623 (Red Hat 4.8.5-44)] >>>> >>>> How can i make changes so that ansible will start using python 3 >>>> >>>> Thanks, >>> >>> RHEL 7 published RPMs for a package called "ansible" are from before >>> the split, to "ansibl-core" which actually has ansible, and the >>> "ansible" package which does not contain ansible, it has a dependency >>> on "ansible-core" and installs more than 100 additional modules from >>> the ansible galaxy collection. It really should have been called >>> "ansible_collections" . >>> >>> You're going to hurt yourself if you keep trying to use that. In the >>> short term, you can use "pip3 install --user ansible-core" to get a >>> much more recent version, ansible-core 2.11. Or bump up to RHEL 8 and >>> you can get a contemporary ansible-core via RPM and avoid these >>> issues. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/e8cb1eb4-8b40-477e-9d4c-587359e11955n%40googlegroups.com. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAOCN9rwU-tc1ngdHJ-1QrKC1KgE0EkRudqOhQonmKwH2-H0x7w%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5AD5212F-13F5-4E12-8723-700545F60B84%40gmail.com.
