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”.