Tried -e its giving the same output as with the -a 

Any example how to use failed_when in ad-hoc command.

e.g i was trying below. How can i use failed_when here. 

/usr/bin/ansible node1 -a "grep 'value1' /tmp/test.log" 



On Monday, February 6, 2017 at 1:57:52 PM UTC+5:30, bablu wrote:
>
>
> How to ignore failed command or in case the result set has no output.  I 
> need the output should be success if it won't find anything relevant 
> mentioned in the condition.
>
>
> /usr/bin/ansible node1 -a "grep 'value1' /tmp/test.log"    Actually there 
> in no value1 exists in test.log. However, i am getting following output. 
>
> node1 | FAILED | rc=1 >>
>
> However, the command ran successfully. Moreover, When i am changing it to 
> the 
>
> /usr/bin/ansible node1 -a "grep 'value1' /tmp/test.log" -a  
> "ignore_errors= yes" 
>
> output is: 
>
> node1 | FAILED | rc=2 >>
> [Errno 2] No such file or directory
>
> While going through some forum found the following are the codes for it. 
> However, is there any way i can get success in the the result set instead 
> of FAIL. 
>
>
>  0       One or more processes were matched.
>  1       No processes were matched.
>  2       Invalid options were specified on the command line.
>  3       An internal error occurred.
>
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/12a10d0e-c6e9-4d1e-921f-69fb715b3d30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to