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
Original Message:
Sent: Thu January 08, 2026 03:20 AM
From: Stephan Dietl
Subject: Ansible playbooks failed with RC 126
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
Original Message:
Sent: Thu January 08, 2026 02:58 AM
From: Joerg Kauke
Subject: Ansible playbooks failed with RC 126
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/kshexport LIBPATH=/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib# Localeexport LANG=en_US.UTF-8export LC_ALL=en_US.UTF-8exec /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/bashansible_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
Original Message:
Sent: Wed January 07, 2026 05:16 AM
From: Shreyansh Chamola
Subject: Ansible playbooks failed with RC 126
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
Original Message:
Sent: Wed January 07, 2026 04:29 AM
From: Joerg Kauke
Subject: Ansible playbooks failed with RC 126
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
------------------------------