Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
  • 1.  Ansible playbooks failed with RC 126

    Posted Wed January 07, 2026 04:30 AM

    Dear community, dear developers.

    I've just starting with ansible and have problems starting my playbook with just simple checks.

    PLAY [Basis Konfiguration für AIX LPARs] *********************************************************************************************************************************************************************************
    
    TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
    [ERROR]: Task failed: Action failed: The following modules failed to execute: ansible.legacy.setup.
    
    Task failed: Action failed.
    
    <<< caused by >>>
    
    The following modules failed to execute: ansible.legacy.setup.
    
    +--[ Sub-Event 1 of 1 ]---
    |
    | Module result deserialization failed: No start of json char found See stdout/stderr for the returned output.
    |
    +--[ End Sub-Event ]---
    
    fatal: [lpar3-0a]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"exception": "(traceback unavailable)", "failed": true, "module_stderr": "Shared connection to 10.5.100.94 closed.\r\n", "module_stdout": "/bin/sh: /opt/freeware/bin/python3: cannot execute\r\n", "msg": "Module result deserialization failed: No start of json char found", "rc": 126}}, "msg": "The following modules failed to execute: ansible.legacy.setup."}
    fatal: [lpar1-0a]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"exception": "(traceback unavailable)", "failed": true, "module_stderr": "Shared connection to 10.5.100.92 closed.\r\n", "module_stdout": "/bin/sh: /opt/freeware/bin/python3: cannot execute\r\n", "msg": "Module result deserialization failed: No start of json char found", "rc": 126}}, "msg": "The following modules failed to execute: ansible.legacy.setup."}
    fatal: [lpar4-0a]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"exception": "(traceback unavailable)", "failed": true, "module_stderr": "Shared connection to 10.5.100.95 closed.\r\n", "module_stdout": "/bin/sh: /opt/freeware/bin/python3: cannot execute\r\n", "msg": "Module result deserialization failed: No start of json char found", "rc": 126}}, "msg": "The following modules failed to execute: ansible.legacy.setup."}
    fatal: [lpar2-0a]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"exception": "(traceback unavailable)", "failed": true, "module_stderr": "Shared connection to 10.5.100.93 closed.\r\n", "module_stdout": "/bin/sh: /opt/freeware/bin/python3: cannot execute\r\n", "msg": "Module result deserialization failed: No start of json char found", "rc": 126}}, "msg": "The following modules failed to execute: ansible.legacy.setup."}
    

    A simple ping on the clients is working.
    To systems are up to date for python and dnf the other two systems have python3.9 installed.
    In my inventory file I have already set 'ansible_python_interpreter=/opt/freeware/bin/python3'
    Do you have suggestions? 

    kind regards,

    Joerg



    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------


  • 2.  RE: Ansible playbooks failed with RC 126

    Posted Wed January 07, 2026 05:17 AM

    Hi Joerg !
    Can you please verify once if all the steps mentioned here are successfully completed: Deploying an Ansible Controller Node Blog

    Also, please share the playbook that you are trying to run.



    ------------------------------
    Shreyansh Chamola
    ------------------------------



  • 3.  RE: Ansible playbooks failed with RC 126

    Posted Thu January 08, 2026 02:58 AM
      |   view attached

    Hello Shreyansh.

    Thanks for the link. I didn't know that site.
    But I'm here in a AIX Environment and the ansible controller node has to be AIX too.

    My playbook is just a simple test:

    ---
    - name: Basis Konfiguration für AIX LPARs
      hosts: nim_clients
      gather_facts: yes  # Sammelt Infos (wie Salt Grains)
      become: yes        # "sudo" bzw. root Rechte nutzen
    
      tasks:
        - name: Sicherstellen, dass bos.perf.tools installiert ist
          ibm.power_aix.installp:
            name: bos.perf.tools
            state: present
            action: apply
    
        - name: Setze Message of the Day
          copy:
            content: "Verwaltet durch Ansible vom SVRSNIMM-0 \n"
            dest: /etc/motd
            owner: root
            group: system
            mode: '0644'
    
        - name: Check free space on /tmp
          shell: "df -m /tmp | tail -1 | awk '{print $3}'"
          register: tmp_space
          changed_when: false # Damit Ansible nicht denkt, wir hätten was geändert
    
        - name: Warnung ausgeben wenn /tmp knapp ist
          debug:
            msg: "Achtung: /tmp hat nur noch {{ tmp_space.stdout }} MB frei!"
          when: tmp_space.stdout | int < 100
    

    The problem I have is, that ansible can't execute python3 at all.
    I already tried some workarounds, creating a script on the clients:

    #!/usr/bin/ksh
    
    export LIBPATH=/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
    
    # Locale
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    
    exec /usr/bin/env /opt/freeware/bin/python3 "$@"
    

    And giving that script to execute via my inventory file:

    [nim_clients:vars]
    ansible_shell_executable=/usr/bin/bash
    ansible_python_interpreter="/usr/bin/ansible_python"
    
    [nim_clients]
    ...
    ...
    ...


    So, I'm out of ideas. Maybe you have any suggestions that I can test.
    I attached the output for my playbook. Maybe it helps.

    Kind regards,
    Joerg





     



    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------

    Attachment(s)

    out
    ansible-playbook.out   21 KB 1 version


  • 4.  RE: Ansible playbooks failed with RC 126

    Posted Thu January 08, 2026 03:21 AM
    Edited by Stephan Dietl Thu January 08, 2026 03:22 AM

    Hello @Joerg Kauke!

    My controller node is also AIX (7.2 though), so maybe we can compare a few things:


    My system:

    ]# ls -alrt /opt/freeware/bin/python3
    lrwxrwxrwx    1 root     system           10 Nov 17 12:53 /opt/freeware/bin/python3 -> python3.12
    ]# ls -alrt /opt/freeware/bin/python3.12
    -rwxr-xr-x    1 root     system        16700 Oct 14 08:11 /opt/freeware/bin/python3.12
    ]# oslevel -s
    7200-05-10-2520
    # sudo dnf list installed python3 ansible*
    Installed Packages
    python3.ppc                                                                                          3.12.12-1                                                                                          @AIX_Toolbox
    ansible.noarch                                                                                     12.1.0-1                                                                                             @AIX_Toolbox_noarch
    ansible-core.noarch                                                                               2.19.3-1                                                                                          @AIX_Toolbox_noarch

    With kind regards,

    Steve



    ------------------------------
    Stephan Dietl
    ------------------------------



  • 5.  RE: Ansible playbooks failed with RC 126

    Posted Thu January 08, 2026 03:46 AM

    Hi Stephan and thanks for your input.

    I think I found my mistake. It was in the playbook itself.
    I set the option "become: yes" and started the playbook as root. So root tried to do sudo on the clients and that is not allowed.
    Lack of knowledge...

    Maybe I'll come back later with more questions ;-)

    kind regards,
    Joerg



    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------



  • 6.  RE: Ansible playbooks failed with RC 126

    Posted Thu January 08, 2026 10:24 AM

    Hi Joerg!

    Is this a typo?

    ansible_python_interpreter="/usr/bin/ansible_python"

    Best regards,

      Alexander



    ------------------------------
    Alexander Reichle-Schmehl
    ------------------------------



  • 7.  RE: Ansible playbooks failed with RC 126

    Posted Fri January 09, 2026 01:53 AM

    Hello Alexander,

    no it's not. My first thought was, that ansible could not access python because of some missing environment variables. So I made a script and started this instead. But as I figured out later, it was not the source of my problem.

    Kinde regards,
    Joerg



    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------



  • 8.  RE: Ansible playbooks failed with RC 126

    Posted 29 days ago

    Hi,

    I had similar issues with Ansible and python, and discovered that the AIX 72 python is 32 bit and AIX 7.3 is 64bit. You need to make this check in you ansible playbook.



    ------------------------------
    Paul Clayton
    ------------------------------



  • 9.  RE: Ansible playbooks failed with RC 126

    Posted 29 days ago

    Hi!

    Now that you mention it, I do remember hat that error code before as well - If I remember correctly in our case it was a incompatibility between the gettext version and the python version we had installed.  That was before we migrated to AIX Toolbox.
    But that should be relatively easy to check by just calling the python interpreter via an ssh connection, for example like this:
    reichle@XXXXXX:~/ansible$ for TESTHOST in mqde01aixtest01 mqde01aixtest02 ; do ssh ${TESTHOST} /opt/freeware/bin/python3 -c 'print\(\"OK\"\)' ; done
    OK
    OK

    Or to check the python interpreter on all members of the hostgroup lpars_aix you could use the following quick hack:

    for TESTHOST in$( ansible -i inventory --list-hosts lpars_aix|grep "    " ) ; do ssh ${TESTHOST} /opt/freeware/bin/python3 -c 'print\(\"OK\"\)' ; done

    Just make sure your connect with the same user you use for your ansible connection, and that the path to your python interpreter above is corrrect.

    Should that work, it would be interesting, if a simple ansible -m ping works.

    Best regards,

      Alexander



    ------------------------------
    Alexander Reichle-Schmehl
    ------------------------------