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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a1c00826-e272-47d7-938e-b0c4c67a9cc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to