mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-07 18:47:55 +03:00
Adding the Vault role
This commit is contained in:
26
roles/vault/tasks/cluster/unseal.yml
Normal file
26
roles/vault/tasks/cluster/unseal.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
|
||||
- name: cluster/unseal | Unseal Vault
|
||||
uri:
|
||||
url: "https://localhost:{{ vault_port }}/v1/sys/unseal"
|
||||
headers: "{{ vault_headers }}"
|
||||
method: POST
|
||||
body_format: json
|
||||
body:
|
||||
key: "{{ item }}"
|
||||
with_items: "{{ vault_unseal_keys|default([]) }}"
|
||||
when: vault_is_sealed
|
||||
|
||||
- name: cluster/unseal | Find the current leader
|
||||
uri:
|
||||
url: "https://localhost:{{ vault_port }}/v1/sys/health"
|
||||
headers: "{{ vault_headers }}"
|
||||
method: HEAD
|
||||
status_code: 200,429
|
||||
register: vault_leader_check
|
||||
|
||||
- name: cluster/unseal | Set fact for current leader
|
||||
set_fact:
|
||||
vault_leader: "{{ item }}"
|
||||
with_items: "{{ groups.vault }}"
|
||||
when: 'hostvars[item]["vault_leader_check"]["status"] == 200'
|
||||
Reference in New Issue
Block a user