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.

27 lines
893 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. return_content: yes
  7. until: vault_etcd_health_check.status == 200 or vault_etcd_health_check.status == 401
  8. retries: 10
  9. delay: 2
  10. delegate_to: "{{groups['etcd'][0]}}"
  11. run_once: true
  12. failed_when: false
  13. register: vault_etcd_health_check
  14. - name: check_etcd | Set fact based off the etcd_health_check response
  15. set_fact:
  16. vault_etcd_available: "{{ vault_etcd_health_check.content }}"
  17. - set_fact:
  18. vault_etcd_available: "{{ vault_etcd_available.health|d()|bool }}"
  19. - name: check_etcd | Fail if etcd is not available and needed
  20. fail:
  21. msg: >
  22. Unable to start Vault cluster! Etcd is not available at
  23. {{ vault_etcd_url }} however it is needed by Vault as a backend.
  24. when: vault_etcd_needed|d() and not vault_etcd_available