unable to parse uri content in a handler

67 views
Skip to first unread message

Anuj Agrawal

unread,
Sep 15, 2014, 9:57:36 AM9/15/14
to ansible...@googlegroups.com
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.

James Cammarata

unread,
Sep 15, 2014, 4:43:38 PM9/15/14
to ansible...@googlegroups.com
Hi Anuj, have you read the documentation page on "failed_when:"? 


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



--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABnk5p1JXRmutiEynn%2BX08Q5feLTVE9OwbrgbFVRb5FaSae2ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Anuj Agrawal

unread,
Sep 16, 2014, 9:21:10 AM9/16/14
to ansible...@googlegroups.com
Hey James, thanks for your reply. Had found it. Forgot to update here.

Reply all
Reply to author
Forward
0 new messages