Skip to content

Instantly share code, notes, and snippets.

@tdelphi
Last active August 1, 2019 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdelphi/0d51494cd1ba4e38d5c5943d93435c44 to your computer and use it in GitHub Desktop.
Save tdelphi/0d51494cd1ba4e38d5c5943d93435c44 to your computer and use it in GitHub Desktop.
Ansbile - wait for webserver to start

• В конце добавить 3 таска

  • name: wait 2 minutes for webserver to start shell: 'curl --head --silent "https://{{ inventory_hostname }}/"' register: result ignore_errors: True async: 120 poll: 1 failed_when: false

  • name: fail if response is not 200 fail: msg="Cannot get 200 status from https://{{ inventory_hostname }}/" when: result.stdout.find("200") == -1

  • name: check response header contains 200 debug: msg="https://{{ inventory_hostname }}/ is up and running" when: result.stdout.find('200 Connection Established') != -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment