Only execute task then certain URL is NOT reachable

Hi,

I have a setup with Apache Mesos and Marathon.
I also deploy a Elasticsearch with JSON to the Mesos Cluster via Ansible.
But this should only be done, when a certain endpont http://mesos…:8080/v2/apps/elasticserach
is NOT reachable. That indicates, that the module is already (or isn’t) installed.

How can I do that in my main.yml?

regards
guenther

The principle is like this.

Use the uri[1] module to check the url and register[2] the output in a variable.

Use when[3] to check the variable to determine if the task should run or not.

[1] https://docs.ansible.com/ansible/uri_module.html
[2] https://docs.ansible.com/ansible/playbooks_variables.html#registered-variables
[3] https://docs.ansible.com/ansible/playbooks_conditionals.html