Hi Anuj, have you read the documentation page on "failed_when:"?

http://docs.ansible.com/playbooks_error_handling.html#controlling-what-defines-failure

I believe you'd want to do something like this:

- name: reinit task_handler
  uri: url=some_url return_content=yes
  register: webpage
  failed_when: '"SOME ERROR STRING" in webpage.content'
  delegate_to: localhost



On Sun, Sep 14, 2014 at 1:46 PM, Anuj Agrawal <[email protected]>
wrote:

> I have a handler of the following form:
>
> - name: reinit task_handler
>   uri: url=some_url return_content=yes
>   register: webpage
>   delegate_to: localhost
>
> Now I want to look for some string in webpage.content and mark this a pass
> or fail. However, I am not able to do this in any way. I tried adding a
> when in the handler, tried to add a notify in this handler and tried to
> examine webpage.content in there and a few more things.
>
> Kindly help.
>
>  --
> 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/CABnk5p1JXRmutiEynn%2BX08Q5feLTVE9OwbrgbFVRb5FaSae2ZQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CABnk5p1JXRmutiEynn%2BX08Q5feLTVE9OwbrgbFVRb5FaSae2ZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAMFyvFj2Zmks8suU4FtWbON%3DJ0wtisQjVZkfkY0RFkAOFM0aug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to