The lookup pipe is returning a 127 error, even though the file exists and has all the required permissions.

570 views
Skip to first unread message

LT

unread,
May 15, 2023, 9:40:31 AM5/15/23
to Ansible Project
I am trying to retrieve the version number of the installed executable. The complete path exists, the file has executable permissions, but I am encountering a 127 error, indicating that the file does not exist. Have I missed something?
Here is the code that I have:
- set_fact: remote_version: "{{ lookup('ansible.builtin.pipe', '/home/' + username + '/program/executable_file' + ' --version') }}"

The error that I am getting:
fatal: [xxx.yyy.zzz.fff]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'ansible.builtin.pipe'. Error was a <class 'ansible.errors.AnsibleError'>, original message: lookup_plugin.pipe(/home/BreadPitt/program/executable --version) returned 127. lookup_plugin.pipe( /home/BreadPitt/program/executable   --version) returned 127"}

Rowe, Walter P. (Fed)

unread,
May 15, 2023, 9:47:24 AM5/15/23
to ansible...@googlegroups.com
My guess is that pipe is trying to run an executable named exactly this: "/home/BreadPitt/program/executable --version" vs passing the --version option to the executable.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/808be77b-2253-48b2-9664-9ad16f8f3ab2n%40googlegroups.com.

Dick Visser

unread,
May 15, 2023, 9:47:37 AM5/15/23
to ansible...@googlegroups.com
Probably because the pipe lookup executes on the ansible controller,
not on the controlled node:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/pipe_lookup.html#notes

LT

unread,
May 15, 2023, 12:15:32 PM5/15/23
to Ansible Project
What is the correct way to use the lookup pipe filter on the remote host?

Matt Martz

unread,
May 15, 2023, 12:46:12 PM5/15/23
to ansible...@googlegroups.com
You don't, you use the command or shell modules, and register the result, potentially manipulating the result into the shape you want with a subsequent `set_fact` task.



--
Matt Martz
@sivel
sivel.net

LT

unread,
May 15, 2023, 10:05:33 PM5/15/23
to Ansible Project
Thank you for clarification.
Reply all
Reply to author
Forward
0 new messages