Note that ansible-core 2.12 is the default available version on RHEL
8, because it's compatible with the built-in python 3.6, and is
available from Red Hat repos as an RPM. So it's a supportable release
on your ansible server, even if your server is on a commercially
supported RHEL.


On Mon, Aug 8, 2022 at 12:24 PM Daniel Barros
<[email protected]> wrote:
>
> I appreciate the time and the answers.
>
>
>
> My customer has an up-to-date Ansible but some server OS are still old.
>
> So I’ll consider using the command module for this special case (yum rhel 6).
>
>
>
> Thank you again.
>
> Br,
>
> Daniel
>
>
>
> On Monday, August 8, 2022 at 10:30:22 AM UTC-3 Matt Martz wrote:
>>
>> The yum module within ansible requires the python yum bindings to work, and 
>> those are only available using Python 2.6.  ansible-core 2.13 no longer 
>> supports Python 2.6, so there is no combination where you can use the yum 
>> module with ansible-core 2.13 on RHEL6.
>>
>> The last version of ansible-core to support Python 2.6 for target execution 
>> was ansible-core 2.12.
>>
>> On Fri, Aug 5, 2022 at 4:42 PM Daniel Barros <[email protected]> wrote:
>>>
>>> I have an Ansible (2.13) machine targeting a remote centOS 6 with Python 
>>> 3.6.
>>>
>>> Remote machine has python3.6 installed and variables are set like this:
>>>
>>>
>>> $ ansible-inventory --host centos-6-vm
>>>
>>> {
>>>
>>>     "ansible_private_key_file": "~/.ssh/id_rsa",
>>>
>>>     "ansible_python_interpreter": "/usr/bin/python3.6",
>>>
>>>     "ansible_user": "daniel"
>>>
>>> }
>>>
>>> Ansible can ping, setup and gather facts from target successfully.
>>>
>>> But when trying to run the yum module, I get an error as if my server 
>>> doesn't have Python 3.6
>>>
>>> This is my playbook
>>>
>>> ---
>>>
>>> - name: Deploy Services
>>>
>>>   hosts: centos-6-vm
>>>
>>>   gather_facts: true
>>>
>>>
>>>
>>>   tasks:
>>>
>>>
>>>
>>>     - name: Show python interpreter
>>>
>>>       debug:
>>>
>>>         var: "{{ item }}"
>>>
>>>       with_items:
>>>
>>>         - ansible_python_interpreter
>>>
>>>         - ansible_python_version
>>>
>>>
>>>
>>>     - name: Patch
>>>
>>>       become: true
>>>
>>>       yum:
>>>
>>>         name: "*"
>>>
>>>         security: true
>>>
>>>         state: latest
>>>
>>>         update_cache: true
>>>
>>> The first task is just to confirm that Ansible is recognizing Python 
>>> versions. And the result is success.
>>>
>>> ok: [centos-6-vm] => (item=ansible_python_interpreter) => {
>>>
>>>     "ansible_loop_var": "item",
>>>
>>>     "ansible_python_interpreter": "/usr/bin/python3.6",
>>>
>>>     "item": "ansible_python_interpreter"
>>>
>>> }
>>>
>>> ok: [centos-6-vm] => (item=ansible_python_version) => {
>>>
>>>     "ansible_loop_var": "item",
>>>
>>>     "ansible_python_version": "3.6.6",
>>>
>>>     "item": "ansible_python_version"
>>>
>>> }
>>>
>>> But when it gets in the module, it gets an error saying no Python3.
>>>
>>> TASK [Patch] 
>>> ***********************************************************************************************************
>>>
>>> fatal: [centos-6-vm]: FAILED! => {"changed": false, "msg": "ansible-core 
>>> requires a minimum of Python2 version 2.7 or Python3 version 3.5. Current 
>>> version: 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red 
>>> Hat 4.4.7-17)]"}
>>>
>>> Any idea how can I approach that?
>>>
>>>
>>>
>>> --
>>>
>>> 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/3176afe0-d6fc-4e63-a4f8-94c20d3a7b16n%40googlegroups.com.
>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>
> --
> 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/51a4eba5-7fc4-4a1a-b684-3a2821c095e3n%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/CAOCN9ry9k3QoD9QZiEn0ndkApg33XQTmQ4g9yLm7L_CJojffcA%40mail.gmail.com.

Reply via email to