Created
September 9, 2019 08:19
-
-
Save maxio89/6c438815cf5c0f92f6a872ba2f42b56e to your computer and use it in GitHub Desktop.
This file contains hidden or 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.2.2/vault_1.2.2_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 vualt="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 | |
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