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

Ansible cannot find python3 when using delegate_to

  • 1.  Ansible cannot find python3 when using delegate_to

    Posted Tue November 08, 2022 07:03 AM
    AIX 7200-05-04
    Ansible 2.9.15


    In a playbook I use the Ansible delegate_to directive as I want to use ibm.power_aix.mount on a client LPAR.

    When this executes I get an error saying that /usr/bin/python3 is not found.

    Python3 is installed in /opt/freeware/bin as you'd expect.

    I have ansible_python_interpreter": "/opt/freeware/bin/python3 in the inventory file for all of the AIX LPARs.

    If I amend the playbook to start a new play and use the client inventory name for the hosts variable rather than using the delegete_to, it works.

    This works:

    - name: Mount the lpp_source as read-only on the target system
      hosts: test
      collections:
        - ibm.power_aix
      become: True
      gather_facts: False

      tasks:

      - name: Mount the lpp_source on the LPAR
        ibm.power_aix.mount:
          state: mount
          mount_dir: /export/nim/lpp_source/7200-05-04-2220-lpp_source
          mount_over_dir: /mnt
          node: xxx-yyy-nfssvr
          read_only: true
    This does not work:

      - name: Mount the lpp_source on the LPAR
        ibm.power_aix.mount:
          state: mount
          mount_dir: /export/nim/lpp_source/7200-05-04-2220-lpp_source
          mount_over_dir: /mnt
          node: xxx-yyy-nfssvr
          read_only: true
        delegate_to: "{{ target }}
    I receive:

    fatal: [nfssvr -> xxx-yyy-test]: FAILED! => {"changed": false, "module_stderr": "/bin/sh: /usr/bin/python3: not found.\n"

    Any suggestions why the delegate_to doesn't use the ansible_python_interpreter value but starting anew play does?

    Thanks
    Glenn

    ------------------------------
    Glenn Robinson
    ------------------------------

    #AIXOpenSource