Better first run bootstrap
This commit is contained in:
parent
75bce82b0f
commit
253069439d
@ -40,9 +40,23 @@
|
||||
name: hvac
|
||||
extra_args: --index-url https://pypi.org/simple
|
||||
|
||||
# This fails on first run because `root_token` isn't found
|
||||
# Fails after taht too because the kv/ space has not been created yet either! Oh noes!
|
||||
# Maybe move data bootstrapping to after the cluster is bootstrapped
|
||||
- name: Check mount
|
||||
community.hashi_vault.vault_read:
|
||||
url: "http://{{ inventory_hostname }}:8200"
|
||||
token: "{{ root_token }}"
|
||||
path: "/sys/mounts/kv"
|
||||
ignore_errors: true
|
||||
register: check_mount
|
||||
|
||||
- name: Create kv mount
|
||||
community.hashi_vault.vault_write:
|
||||
url: "http://{{ inventory_hostname }}:8200"
|
||||
token: "{{ root_token }}"
|
||||
path: "/sys/mounts/kv"
|
||||
data:
|
||||
type: kv-v2
|
||||
when: check_mount is not succeeded
|
||||
|
||||
- name: Write values
|
||||
no_log: true
|
||||
community.hashi_vault.vault_write:
|
||||
@ -53,6 +67,8 @@
|
||||
data:
|
||||
"{{ item.value }}"
|
||||
loop: "{{ hashi_vault_values | default({}) | dict2items }}"
|
||||
retries: 2
|
||||
delay: 5
|
||||
|
||||
- name: Write userpass
|
||||
no_log: true
|
||||
|
Loading…
Reference in New Issue
Block a user