IBM / ansible-power-aix

Developer contributions for Ansible Automation on Power
https://ibm.github.io/ansible-power-aix/
GNU General Public License v3.0
81 stars 95 forks source link

Playbook that executes emgr module to install efix fails for 2 lpars but not others #567

Closed platanip closed 2 months ago

platanip commented 2 months ago

I have a playbook that uses the emgr module option install to install an efix however when I run it on 2 of our lpars it fails. It works fine on all our lpars in our inventory except for those 2.

PLAY [Install efix on host group "TIBCO" lpars] **** TASK [Gathering Facts] *** ok: [aup4292l.unix.anz] ok: [aup4293l.unix.anz] TASK [Create directory as per efix_folder_dest variable if it does not exist] * changed: [aup4292l.unix.anz] changed: [aup4293l.unix.anz] TASK [Distribute efix package from local to remote lpar] ***** changed: [aup4292l.unix.anz] changed: [aup4293l.unix.anz] TASK [Install "81112ma.240224.epkg.Z" ifix package with preview] * fatal: [aup4292l.unix.anz]: FAILED! => {"changed": false, "cmd": "emgr -c -L81112ma", "msg": "[Errno 2] No such file or directory: b'emgr': b'emgr'", "rc": 2, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []} fatal: [aup4293l.unix.anz]: FAILED! => {"changed": false, "cmd": "emgr -c -L81112ma", "msg": "[Errno 2] No such file or directory: b'emgr': b'emgr'", "rc": 2, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []} PLAY RECAP ***** aup4292l.unix.anz : ok=3 changed=2 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
aup4293l.unix.anz : ok=3 changed=2 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

The output from my job:-

{ "rc": 2, "stdout": "", "stderr": "", "cmd": "emgr -c -L81112ma", "msg": "[Errno 2] No such file or directory: b'emgr': b'emgr'", "invocation": { "module_args": { "action": "install", "ifix_package": "/tmp/efix/81112ma.240224.epkg.Z", "from_epkg": true, "preview": true, "mount_install": false, "commit": false, "extend_fs": false, "force": false, "quiet": false, "ifix_label": null, "ifix_number": null, "ifix_vuid": null, "package": null, "alternate_dir": null, "list_file": null, "working_dir": null, "bosboot": null, "verbose": null } }, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "changed": false }

The "whereis emgr" command returns /usr/sbin/emgr on both failed lpars. aup4292l:/[512]# whereis emgr emgr: /usr/sbin/emgr

aup4293l:/[512]# whereis emgr emgr: /usr/sbin/emgr Both lpars are running python 3.7.11

Please advise what the issue may be

nitismis commented 2 months ago

Hi @platanip "whereis emgr" will always show the path of the command, in this case /usr/sbin/emgr, but, it is not a guarantee that the path is actually set in the LPAR. To know if path is set, you should try "which sbin". In your case the "/usr/sbin" is not set in the PATH system environment variable and so it is not able to find out "emgr". Solution:

  1. Run export PATH=/usr/sbin:$PATH in both LPARs and then try again running the playbook.
  2. Second option is that you can use PATH environment from within the playbook as is shown here: https://github.com/IBM/ansible-power-aix/blob/dev-collection/playbooks/demo_dnf.yml

Hope this solves the problem. Please confirm once it does, so that, we can close the issue.

Thanks, Nitish

platanip commented 2 months ago

Hi Nitish

I ran solution 1: to set the path export PATH=/usr/sbin:$PATH but running the playbook failed again. I tried solution 2. by adding environment: PATH: /usr/sbin
to my playbook and it worked fine so you may now close the issue as resolved.

Thanks Peter

nitismis commented 2 months ago

Thank you !