2017-02-08 21:41:36 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: find_leader | Find the current http Vault leader
|
|
|
|
uri:
|
|
|
|
url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://localhost:{{ vault_port }}/v1/sys/health"
|
|
|
|
headers: "{{ hostvars[groups.vault|first]['vault_headers'] }}"
|
|
|
|
method: HEAD
|
2018-05-11 16:11:38 +00:00
|
|
|
status_code: 200,429,501,503
|
2017-02-08 21:41:36 +00:00
|
|
|
register: vault_leader_check
|
|
|
|
until: "vault_leader_check|succeeded"
|
|
|
|
retries: 10
|
|
|
|
|
|
|
|
- name: find_leader | Set fact for current http leader
|
|
|
|
set_fact:
|
2018-05-11 16:11:38 +00:00
|
|
|
vault_leader_url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://{{ inventory_hostname }}:{{ vault_port }}"
|
2017-02-08 21:41:36 +00:00
|
|
|
with_items: "{{ groups.vault }}"
|
2018-05-11 16:11:38 +00:00
|
|
|
when: "hostvars[item]['vault_leader_check'].get('status') in [200,501,503]"
|
2017-08-24 09:09:52 +00:00
|
|
|
# run_once: true
|
2017-07-27 17:46:21 +00:00
|
|
|
|
2017-08-18 12:09:45 +00:00
|
|
|
- name: find_leader| show vault_leader_url
|
|
|
|
debug: var=vault_leader_url verbosity=2
|