Compare commits

..

No commits in common. "813d1cd38aedd5b14a9a6327d4a388ad9103c20a" and "ef4452e5d80d0dac7203a1ed6e89cce9fabdd6c4" have entirely different histories.

View File

@ -28,7 +28,7 @@ mkdir -p ~/.ssh &> /dev/null
apt-get install -y python3-pip python3-venv jq git curl &> /dev/null apt-get install -y python3-pip python3-venv jq git curl &> /dev/null
python3 -m venv /opt/ansible &> /dev/null python3 -m venv /opt/ansible &> /dev/null
/opt/ansible/bin/pip3 install ansible hvac netaddr jmespath &> /dev/null /opt/ansible/bin/pip3 install ansible hvac netaddr &> /dev/null
HOSTNAME=$1 HOSTNAME=$1
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
@ -138,6 +138,7 @@ if [ ! -f ~/.ansible/vars.yml ]; then
openssl rand -base64 64 | tr -d '\n' | head -c 64 > ~/.ansible/vault.yml openssl rand -base64 64 | tr -d '\n' | head -c 64 > ~/.ansible/vault.yml
ANSIBLE_VAULT_SECRET=$(<~/.ansible/vault.yml) ANSIBLE_VAULT_SECRET=$(<~/.ansible/vault.yml)
HASHICORP_VAULT_SECRET=$(openssl rand -base64 64 | tr -d '\n' | head -c 64)
echo "---" > ~/.ansible/vars.yml echo "---" > ~/.ansible/vars.yml
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
@ -147,6 +148,7 @@ if [ ! -f ~/.ansible/vars.yml ]; then
echo " secret: $ANSIBLE_VAULT_SECRET" >> ~/.ansible/vars.yml echo " secret: $ANSIBLE_VAULT_SECRET" >> ~/.ansible/vars.yml
echo " hashicorp:" >> ~/.ansible/vars.yml echo " hashicorp:" >> ~/.ansible/vars.yml
echo " domain: $VAULT_DOMAIN" >> ~/.ansible/vars.yml echo " domain: $VAULT_DOMAIN" >> ~/.ansible/vars.yml
echo " password: $HASHICORP_VAULT_SECRET" >> ~/.ansible/vars.yml
/opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null /opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null
fi fi