You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
813 B

  1. ---
  2. - name: check_etcd | Check if etcd is up and reachable
  3. uri:
  4. url: "{{ vault_etcd_url }}/health"
  5. validate_certs: no
  6. until: vault_etcd_health_check.status == 200 or vault_etcd_health_check.status == 401
  7. retries: 10
  8. delay: 2
  9. delegate_to: "{{groups['etcd'][0]}}"
  10. run_once: true
  11. failed_when: false
  12. register: vault_etcd_health_check
  13. - name: check_etcd | Set fact based off the etcd_health_check response
  14. set_fact:
  15. vault_etcd_available: "{{ vault_etcd_health_check.get('json', {}).get('health')|bool }}"
  16. - name: check_etcd | Fail if etcd is not available and needed
  17. fail:
  18. msg: >
  19. Unable to start Vault cluster! Etcd is not available at
  20. {{ vault_etcd_url }} however it is needed by Vault as a backend.
  21. when: vault_etcd_needed|d() and not vault_etcd_available