It looks like your recent run found pbrun. I recently worked with a client 
that used pbrun and here's a brief walkthrough of what they did to fix it. 
Also, could you retry via a playbook (not ad hoc) and add -vvvv to the run.
>
>
> When you issue a pbrun command such as pbrun /bin/foo/hello –nice –day, PB 
> sets up some variables.
> The first variable is called command and it’s a read-only variable. It’s a 
> string variable, and in the above example would store /bin/foo/hello.
> The next variable is called argv and it too is a read-only variable. This 
> time though, it’s a list and not a string. In the above example would store 
> {‘/bin/foo/hello’, ‘-nice’, ‘-day’}.
>
> So argv[0] is hello, argv[1] is –nice and argv[2] is –day.
>
> The important thing to note is anything and everything passed after 
> command is treated as argv arguments to command. This is why things weren’t 
> working when Ansible was passing multiple commands to a single pbrun 
> command.
>
> PB also has 2 other variables called runcommand and runargv. They are 
> similar to command and argv, and by default contain the same exact values 
> as their counterparts. The difference being is that these variables are 
> modifiable. Their values override the read-only variables if they differ.
>
> What I had to do is this:
> · Change runcommand to /bin/bash
> · runargv[0] automatically changes to bash.
> · Next, I appended runargv by adding –c to it to make it {‘/bin/bash’, 
> ‘-c’}
> · Finally, I appended argv to runargv making runargv be {‘bash’, ‘-c’, 
> ‘/bin/foo/hello’, ‘-nice’, ‘-day’}
> · With all that in place, I allow the command to execute with the new 
> runcommand and runargv in place.


On Monday, April 4, 2016 at 6:30:47 PM UTC-4, phillip....@gmail.com wrote:
>
> Interesting. I was not aware of this : <<*Consider adding those 
> environment variables in the .bashrc file. I guess the reason behind this 
> is the login and the non-login shells .Ansible, while executing different 
> tasks reads the parameters from a .bashrc file instead of the bash_profile 
> or the /etc/profile.*>>
>
> so, I tried on just one host to add the absolute path i need in my 
> $HOME/.bashrc, but still it is not working ... I'm not very familiar with 
> pbrun, and I'm not allowed to change the pbrun installation or 
> configuration in any way in this environment.
>
> $  ansible  all -i myhosts2 -m shell -a 'echo $PATH'
> host1.mydom.com | SUCCESS | rc=0 >>
>
> /usr/lib64/qt-3.3/bin:/usr/local/maven-3.2.1/bin:/usr/local/bin:/bin:/usr/bin:/opt/pb/bin
>
> $ ansible all -i myhosts2 -o -m shell -a 'uptime' -b --become-method pbrun
> host1.mydom.com | FAILED! => {"changed": false, "failed": true, 
> "module_stderr": "", "module_stdout": "usage: pbrun [-D level] -h | -K | -k 
> | -V\r\nusage: pbrun -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] 
> [-u user\r\n             name|#uid]\r\nusage: pbrun -l[l] [-AknS] [-D 
> level] [-g groupname|#gid] [-p prompt] [-U user\r\n             name] [-u 
> user name|#uid] [-g groupname|#gid] [command]\r\nusage: pbrun [-AbEHknPS] 
> [-r role] [-t type] [-C fd] [-D level] [-g\r\n             groupname|#gid] 
> [-p prompt] [-u user name|#uid] [-g\r\n             groupname|#gid] 
> [VAR=value] [-i|-s] [<command>]\r\nusage: pbrun -e [-AknS] [-r role] [-t 
> type] [-C fd] [-D level] [-g\r\n             groupname|#gid] [-p prompt] 
> [-u user name|#uid] file ...\r\n", "msg": "MODULE FAILURE", "parsed": false}
>
> $ pbrun -V
> Sudo version 1.8.6p3
> Sudoers policy plugin version 1.8.6p3
> Sudoers file grammar version 42
> Sudoers I/O plugin version 1.8.6p3
>
> On Monday, April 4, 2016 at 12:15:52 PM UTC-6, Benjamin Redling wrote:
>>
>> On 2016-04-04 20:01, phillip....@gmail.com wrote: 
>> > So this really seem to be a matter of PATH. -- i'm confused why i'm not 
>> > getting the correct path 
>>
>> login vs non-login shell? 
>>
>>
>> http://stackoverflow.com/questions/27733511/how-to-set-linux-environment-variables-with-ansible
>>  
>>
>> Benjamin 
>> -- 
>> FSU Jena | JULIELab.de/Staff/Benjamin+Redling.html 
>> vox: +49 3641 9 44323 | fax: +49 3641 9 44321 
>>
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/568bca43-7af3-43c1-a02f-4b3f4f66efdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to