k8s-playground/setup/generate-keys.sh

8 lines
411 B
Bash
Executable File

cd host_vars
for i in cluster-frontend cluster-control01 cluster-control02 cluster-control03 cluster-worker01 cluster-worker02 cluster-worker03 cluster-worker04 cluster-worker05 cluster-worker06
do
sed -i "s#^wg_secret_key.*#wg_secret_key: $(wg genkey)#" ${i}.yaml
pubkey=$(cat ${i}.yaml | yq .wg_secret_key | sed 's/"//g' | wg pubkey)
sed -i "s#^wg_public_key.*#wg_public_key: ${pubkey}#" ${i}.yaml
done