-
I've encountered a strange problem with decrypted secrets in canned scripts for ansible deployment and have no idea whats happening. ...
check_ansible_version
kapitan compile -t c01 --fetch --force --reveal
cat $DIR/install_eswe.sh install_eswe.sh #!/bin/bash
set -e # If a command fails, the whole script exit
set -u # Treat unset variables as an error, and immediately exit.
set -o pipefail # this will make your script exit if any command in a pipeline errors
DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
source "${DIR}"/common.sh
pushd $ESWE_DIR &> /dev/null
ansible-playbook provision.yml -vvvv -i $ROOT_DIR/compiled/c01/ansible -b \
'-e allowreboot=true ansible_user=?{gkms:passwords/lab-bm@ansible_creds.user:a7b9736c} ansible_password=?{gkms:passwords/lab-bm@ansible_creds.password:a7b9736c}' Script log:
14:46:40 > cat ./compiled/c01/ansible/scripts/install_eswe.sh
#!/bin/bash
set -e # If a command fails, the whole script exit
set -u # Treat unset variables as an error, and immediately exit.
set -o pipefail # this will make your script exit if any command in a pipeline errors
DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
source "${DIR}"/common.sh
pushd $ESWE_DIR &> /dev/null
ansible-playbook provision.yml -vvvv -i $ROOT_DIR/compiled/c01/ansible -b \
'-e allowreboot=true ansible_user=root ansible_password=pass' 14:46:47 > grep '?{gkms:passwords/lab-bm@ansible_creds.user:a7b9736c}' compiled/c01/* -R
14:46:53 > grep '?{gkms:passwords/lab-bm@ansible_creds.user:a7b9736c}' .ansible/* -R
When run locally it happens almost every second try. That is I run the script and it fails to connect because secrets look encrypted, even though cat of the script file shows that it's decrypted, and on the second run it will work as expected, and then it can fail again. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think i've got it. It's the way i run the bash scripts 🤦 |
Beta Was this translation helpful? Give feedback.
I think i've got it. It's the way i run the bash scripts 🤦
Now that I've described it in one place i can see it^^
I'll mark this as the answer without explaining, since the small thought exercise is the only value of this...