# URI and Until

**URL:** <https://forum.ansible.com/t/uri-and-until/17093>\
**Category:** Ansible Project\
**Created:** [December 17, 2014, 9:22pm UTC](https://forum.ansible.com/t/uri-and-until/17093 "2014-12-17T21:22:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Hughes](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Matt\_Hughes](https://forum.ansible.com/u/Matt_Hughes)\
**Post date:** [December 17, 2014, 9:22pm UTC](https://forum.ansible.com/t/uri-and-until/17093/1 "2014-12-17T21:22:20Z")

</div>

I have a cluster of N nodes. Cluster status is reported by http://cluster\_fqdn/health/. I want to do a rolling upgrade of every node in my cluster with serial: 1. I don’t want to proceed to the next node until http://cluster\_fqdn/health/ reports the cluster is healthy.

Trying to use uri and until, but can’t seem to get the syntax quite right:

`

- name: Await Cluster Healthy Status  
uri: url=http://{{host\_ip}}/cluster\_health/ return\_content=yes  
register: cluster\_health  
until: “green” in "{{cluster\_health.content}}  
retries: 100  
delay: 10

`

errors out with:

ERROR: Syntax Error while loading YAML script, main.yml

Note: The error may actually appear before this position: line 67, column 18

register: cluster\_health

until: “green” in “{{cluster\_health.content}}”

I was going by the example here: [http://docs.ansible.com/uri\_module.html](http://docs.ansible.com/uri_module.html)

I also tried using the example here ([http://docs.ansible.com/playbooks\_loops.html#do-until-loops](http://docs.ansible.com/playbooks_loops.html#do-until-loops))

`

- name: Await Cluster Healthy Status  
uri: url=http://{{host\_ip}}/cluster\_health/ return\_content=yes  
register: cluster\_health  
until: cluster\_health.content.contains(“green”) != -1  
retries: 100  
delay: 10  
`

but that fails with:

fatal: [prod.clustertest-elk-fxbo-1] =\> error while evaluating conditional: cluster\_health.content.contains(“green”) != -1

Took me a while to realize I needed to install liburi module, but that’s a different story. I debugged ‘cluster\_health’ var and it definitely contains the word “green”.

---

<div class="post-metadata">

**Author:** ![Matt\_Hughes](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Matt\_Hughes](https://forum.ansible.com/u/Matt_Hughes)\
**Post date:** [December 17, 2014, 9:31pm UTC](https://forum.ansible.com/t/uri-and-until/17093/2 "2014-12-17T21:31:00Z")

</div>

The error was ‘contains’ isn’t a method. ‘find’ is though.

I love Ansible, but the error reporting really leaves a lot to be desired. Still have no idea what was wrong with the first example. Maybe until and when have different conditional syntaxes?
