Hello Andrey,
I try to update ansible.cfg with below content. But still getting same error. Can you please check whether added variable is correct or not? Anything else we need to do.
This is my ansible.cfg file, in lieu of discovered_interpreter_python I used ansible_python_interpreter but same issue. I also try to use this ansible_python_interpreter: /opt/freeware/bin/python3
cat ansible.cfg
[defaults]
inventory=/home/automation/ansible/systemfiles/inventory
log_path=/home/automation/ansible/systemfiles/ansible_logs
discovered_interpreter_python=/opt/freeware/bin/python3
forks=10
interpreter_python=auto_silent
[privilege_escalation]
become=true
become_user=root
become_method=sudo
------------------------------
Manoj Kumar
------------------------------
Original Message:
Sent: Tue March 07, 2023 03:11 AM
From: Andrey Klyachkin
Subject: Ansible setup on AIX
Hi Manoj,
Ansible looks for python interpreter in /usr/bin/python. Old RPM packages created a symlink in /usr/bin for python binaries. New RPM packages don't do it anymore. Because you didn't provide any error message, I can suppose that this is the reason for your failure - the failing server doesn't have /usr/bin/python.
The choices you have:
- create symlinks in /usr/bin. I wouldn't recommend unless you know what you're doing.
- add a variable ansible_python_interpreter: /opt/freeware/bin/python3 in your playbooks. This is my favourite way of solving the problem.
- add a global configuration interpreter_python = /opt/freeware/bin/python3 in /opt/freeware/etc/ansible/ansible.cfg on your Ansible controller node.
More about Python discovery in Ansible you can read here - https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
------------------------------
Andrey Klyachkin
https://www.power-devops.com
Original Message:
Sent: Mon March 06, 2023 09:39 AM
From: Manoj Kumar
Subject: Ansible setup on AIX
Hi Team,
I am trying to setup ansible on AIX, so we have installed ansible and python on AIX servers. On client one of the server having python2 and other having python3.
I am not sure how python2 was installed, it seems it was installed manually with all dependency altogether with rpm command.
Python3 was installed with dnf install command, so everything was installed automatically and updated. Python3 client is not working because having some link with other directory but python2 is working fine which is having link with /usr/bin/ directory. So I am not sure which is the correct way of doing this setup.
Would you please help?
Working client ->
root@dsmppa003t:/opt/freeware/bin# ls -ltr /usr/bin/python*
lrwxrwxrwx 1 root system 35 Aug 25 08:38 /usr/bin/python2.7_64 -> ../../opt/freeware/bin/python2.7_64
lrwxrwxrwx 1 root system 39 Aug 25 08:38 /usr/bin/python2.7-config -> ../../opt/freeware/bin/python2.7-config
lrwxrwxrwx 1 root system 32 Aug 25 08:38 /usr/bin/python2.7 -> ../../opt/freeware/bin/python2.7
lrwxrwxrwx 1 root system 37 Aug 25 08:38 /usr/bin/python2-config -> ../../opt/freeware/bin/python2-config
lrwxrwxrwx 1 root system 30 Aug 25 08:38 /usr/bin/python2 -> ../../opt/freeware/bin/python2
lrwxrwxrwx 1 root system 36 Aug 25 08:38 /usr/bin/python-config -> ../../opt/freeware/bin/python-config
lrwxrwxrwx 1 root system 29 Aug 25 08:38 /usr/bin/python -> ../../opt/freeware/bin/python
lrwxrwxrwx 1 root system 39 Aug 25 08:38 /usr/bin/python_64-config -> ../../opt/freeware/bin/python_64-config
lrwxrwxrwx 1 root system 32 Aug 25 08:38 /usr/bin/python_64 -> ../../opt/freeware/bin/python_64
lrwxrwxrwx 1 root system 40 Aug 25 08:38 /usr/bin/python2_64-config -> ../../opt/freeware/bin/python2_64-config
lrwxrwxrwx 1 root system 33 Aug 25 08:38 /usr/bin/python2_64 -> ../../opt/freeware/bin/python2_64
lrwxrwxrwx 1 root system 42 Aug 25 08:38 /usr/bin/python2.7_64-config -> ../../opt/freeware/bin/python2.7_64-config
Non-working client ->
root@dsmppa001s:/opt/freeware/bin#
lrwxrwxrwx 1 root system 10 Jan 09 08:09 python3 -> python3_64
lrwxrwxrwx 1 root system 12 Jan 09 08:09 python3.7 -> python3.7_64
lrwxrwxrwx 1 root system 13 Jan 09 08:09 python3.7_32 -> python3.7m_32
lrwxrwxrwx 1 root system 13 Jan 09 08:09 python3.7_64 -> python3.7m_64
lrwxrwxrwx 1 root system 13 Jan 09 08:09 python3.7m -> python3.7m_64
lrwxrwxrwx 1 root system 12 Jan 09 08:09 python3_32 -> python3.7_32
lrwxrwxrwx 1 root system 12 Jan 09 08:09 python3_64 -> python3.7_64
lrwxrwxrwx 1 root system 13 Jan 09 08:09 pyvenv-3.7 -> pyvenv-3.7_64
lrwxrwxrwx 1 root system 9 Jan 09 08:09 pyvenv -> pyvenv_64
------------------------------
Manoj Kumar
------------------------------