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?

On Wednesday, December 17, 2014 4:22:20 PM UTC-5, Matt Hughes wrote:
>
> 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
>
>
>
> I also tried using the example here (
> 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".   
>

-- 
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/196a4c09-2e20-48e2-b766-798d917c4ef7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to