I run a start script using Ansible as below:
- name: Start service
raw: "source ~/.profile; ~/start.sh"
Now, I want to keep checking the HTTP status for the services I started above until it is successful — 200
.
Below is how I check for HTTP status 200
, but, I do not know how to keep checking for 2 minutes and report if the URL still does not return 200
.
- name: Detect if HTTp response is '200'
uri:
url: 'http://example.org/iportal/'
return_content: yes
validate_certs: no
status_code:
- 200
register: uri_output