Commit 48ded72e by Ned Batchelder

Put the password generator into a real .sh file

Use my-passwords.yml in sandbox.sh
parent 0df26e09
#!/usr/bin/env bash
#
# Read a list of Ansible variables that should have generated values, and make
# a new file just like it, with the generated values.
TARGET=${OPENEDX_RELEASE-master}
wget -q "https://raw.githubusercontent.com/edx/configuration/$TARGET/playbooks/sample_vars/passwords.yml" -O passwords-template.yml
while IFS= read -r line; do
# Make a random string. SECRET_KEY's should be longer.
length=35
if [[ $line == *SECRET_KEY* ]]; then
length=100
fi
REPLACE=$(LC_ALL=C < /dev/urandom tr -dc 'A-Za-z0-9' | head -c$length)
# Change "!!null"-to-end-of-line to the password.
echo "$line" | sed "s/\!\!null.*/\'$REPLACE\'/"
done < passwords-template.yml > my-passwords.yml
......@@ -66,6 +66,11 @@ for var in ${VERSION_VARS[@]}; do
fi
done
# my-passwords.yml is the file made by generate-passwords.sh.
if [[ -f my-passwords.yml ]]; then
EXTRA_VARS="-e@$(pwd)/my-passwords.yml $EXTRA_VARS"
fi
CONFIGURATION_VERSION=${CONFIGURATION_VERSION-${OPENEDX_RELEASE-master}}
##
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment