I think a more "ansiblish" approach would be:

  - name: wait node {{ansible_hostname}}-{{service}} 
    uri: url=http://localhost:9200/_cat/nodes?h=name
         timeout=120
         return_content=yes
    register: result
    until: (ansible_hostname + '-' + service) in result.content
    retries: 200 
    delay: 3




On Thursday, September 18, 2014 3:21:16 PM UTC+2, Lance A. Brown wrote:
>
> On 2014-09-17 11:06 pm, Brian Coca wrote: 
> > well, in that case I would use wait_for to let the server come up and 
> > then get_url inside a do-until loop to get the 'green light'. 
>
> I had that configuration initially after I realized wait_for would not 
> do what I needed.  Then I realized setting a timeout on the curl call 
> (-m 2) gets me effectively the same thing.  If the node isn't back up 
> yet, the curl call times out and the grep fails.  No need to run two 
> tasks. 
>
> --[Lance] 
>
> - name: wait node {{ansible_hostname}}-{{service}} 
>    local_action: "shell curl -s -m 2 'localhost:9200/_cat/nodes?h=name' | 
> tr -d ' ' | grep -E '^{{ansible_hostname}}-{{service}}$' " 
>    register: result 
>    until: result.rc == 0 
>    retries: 200 
>    delay: 3 
>    notify: 
>    - cluster routing all {{ansible_hostname}}-{{service}} 
>
>
>

-- 
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/f3fd3d11-e020-4194-aa8b-bd08a4c757c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to