mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-02 14:55:37 +02:00
Update to 2023-07-08 16:00
This commit is contained in:
20
roles/vault_agent/templates/nomad/update_nomad_cert.sh.j2
Normal file
20
roles/vault_agent/templates/nomad/update_nomad_cert.sh.j2
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
VAULT_ADDR={{ vault_agent_vault_address }}
|
||||
VAULT_STATUS=$(vault status -format=json)
|
||||
|
||||
if [ "$(echo ${VAULT_STATUS} | jq .is_self)" != "true" ]; then
|
||||
echo "We're not the active vault, exiting"
|
||||
elif [ "$(echo ${VAULT_STATUS} | jq .sealed)" != "false" ]; then
|
||||
echo "Vault is sealed, exiting"
|
||||
elif [ "$(echo ${VAULT_STATUS} | jq .initialized)" != "true" ]; then
|
||||
echo "Vault is not initialized yet, exiting"
|
||||
else
|
||||
echo Updating Vault certificate to access Nomad API
|
||||
vault write {{ vault_agent_nomad.nomad_pki.cli.secret_path }}/config/access \
|
||||
ca_cert="$(cat {{ nomad_root_dir }}/tls/ca.crt)" \
|
||||
client_cert="$(cat {{ nomad_root_dir }}/tls/cli.crt)" \
|
||||
client_key="$(cat {{ nomad_root_dir }}/tls/cli.key)"
|
||||
fi
|
Reference in New Issue
Block a user