Last active
April 14, 2019 05:01
-
-
Save rogmanster/c6aefd27838d719d54717c598f3f52a0 to your computer and use it in GitHub Desktop.
Vault Dev Instance for Azure - workspaces/terraform-azure-vault-dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
echo "-> Installing dependencies....." | |
apt-get update | |
apt-get upgrade | |
apt-get install -y \ | |
apt-transport-https \ | |
build-essential \ | |
ca-certificates \ | |
curl \ | |
git \ | |
jq \ | |
less \ | |
software-properties-common \ | |
unzip \ | |
vim | |
echo "-> Downloading Vault....." | |
cd /tmp && { | |
curl -sfL -o vault.zip "https://releases.hashicorp.com/vault/1.1.0/vault_1.1.0_linux_amd64.zip" | |
unzip -qq vault.zip | |
sudo mv vault /usr/local/bin/vault | |
sudo chmod +x /usr/local/bin/vault | |
rm -rf vault.zip | |
} | |
echo "-> Writing profile....." | |
tee "/etc/profile.d/vault.sh" > /dev/null <<"EOF" | |
alias vault="vault" | |
export VAULT_ADDR="http://127.0.0.1:8200" | |
EOF | |
. "/etc/profile.d/vault.sh" | |
echo "-> Writing systemd unit....." | |
tee "/etc/systemd/system/vault.service" > /dev/null <<"EOF" | |
[Unit] | |
Description=Vault Server | |
Requires=network-online.target | |
After=network.target | |
[Service] | |
Environment=GOMAXPROCS=8 | |
Environment=VAULT_ADDR=http://127.0.0.1:8200 | |
Environment=VAULT_DEV_ROOT_TOKEN_ID=root | |
Restart=on-failure | |
ExecStart=/usr/local/bin/vault server -dev -dev-listen-address=0.0.0.0:8200 | |
ExecReload=/bin/kill -HUP $MAINPID | |
KillSignal=SIGINT | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
echo "-> Starting vault....." | |
systemctl enable vault | |
systemctl start vault |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment