2022-07-23 14:00:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eo pipefail
|
2023-07-26 19:00:19 +02:00
|
|
|
{% if consul_conf.server %}
|
|
|
|
if [ -e /etc/profile.d/vault.sh ]; then
|
|
|
|
source /etc/profile.d/vault.sh
|
|
|
|
fi
|
|
|
|
if [ -e /etc/profile.d/consul.sh ]; then
|
|
|
|
source /etc/profile.d/consul.sh
|
|
|
|
fi
|
|
|
|
{% if consul_conf.acl.enabled and consul_backup_token is defined %}
|
|
|
|
export CONSUL_HTTP_TOKEN={{ consul_backup_token }}
|
2024-10-24 12:00:41 +02:00
|
|
|
# Give some time for the token to be replicated (if obtained from vault)
|
|
|
|
sleep 0.1
|
2023-07-26 19:00:19 +02:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2023-09-20 10:00:24 +02:00
|
|
|
consul snapshot save -append-filename version,dc,node,status {{ consul_root_dir }}/backup/consul.snap
|