#!/usr/bin/env bash

for v in $(grep '\!vault' $1 | cut -d: -f1); do
   val=$(yq e .${v} $1 | tr -d ' ' | ansible-vault decrypt)
   echo $v = \"$val\" 
done

exit

yq -P e "$(for v in $(grep '\!vault' $VARS_FILE | cut -d: -f1); do val=$(yq e .${v} $VARS_FILE | tr -d ' ' | ansible-vault decrypt); echo .$v = \"$val\" \|; done) null = null" $VARS_FILE
