AIX Open Source

 View Only
Expand all | Collapse all

Ansible setup on AIX

  • 1.  Ansible setup on AIX

    Posted 21 days ago

    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
    ------------------------------


  • 2.  RE: Ansible setup on AIX

    Posted 21 days ago

    I suggest to not to use python2 anymore.

    Python2 is out of support.

    One thing I can think of if you module looks for /usr/bin/python then they will find it for python2 installed on AIX.

    AIX toolbox python2 delivers /usr/bin/python link.

    So if that is the case then you need to set correct python in your module for python3 or create sylink in your AIX.

    But please be careful when creating symlink by not breaking existing code.

     

    Thanks,

     

    Sanket Rathi

     






  • 3.  RE: Ansible setup on AIX

    IBM Champion
    Posted 21 days ago

    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
    ------------------------------



  • 4.  RE: Ansible setup on AIX

    Posted 18 days ago

    Thanks Andrey for the update, we are checking this.



    ------------------------------
    Manoj Kumar
    ------------------------------



  • 5.  RE: Ansible setup on AIX

    Posted 14 days ago

    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
    ------------------------------



  • 6.  RE: Ansible setup on AIX

    Posted 14 days ago

    You can do "ansible-config dump | grep -i interpreter" and share the output here. 



    ------------------------------
    Ayappan P
    ------------------------------