On 09.02.17 19:36 DHAVAL JAISWAL wrote:
> I want to use the failed_when in following ad-hoc command to ignore
> the error. Is there any other alternative can be handle in ad hoc
> command.
> 
> /usr/bin/ansible node1 -a "grep 'value1' /tmp/test.log"

As nobody came up with a solution, I would assume that failed_when is
only applicable to tasks, not to ad-hoc commands.

Workaround: Use the shell module and make your command exit with an
error != 1:

/usr/bin/ansible node1 -m shell -a "grep 'value1' /tmp/test.log || exit 0"


Johannes

-- 
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/50962d2a-04f8-6c0c-3172-e5fa52d09bef%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to