From 54fd61c887f266f8e2e6b1419a86fc6681116069 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Jun 2019 16:38:53 -0300 Subject: Use Ansible instead of Bash for provisioning The deployment is not quite working, and I'm unable to test right now: DigitalOcean is returning 503 for my requests. As of this commit, I can run =ansible-playbook provider.yml= more than once and it will actually be idempotent. Notes: - SSH fingerprint are now taken from the public key file instead of manually supplying it in the terraform template using the =digitalocean_ssh_key= resource; - use Ansible instead of ad-hoc Bash scripts for provisioning the Droplets created by Terraform; - use the =filename.env.extension= to create the concrete files in CI; - use the =user_data= to add the know SSH key pair to the newly created Droplet; - add =rotate-ssh-keys.sh= utils; --- scripts/box/bash-aliases.sh | 3 --- scripts/box/bash-profile.sh | 4 ++++ scripts/box/run-backup-template.sh | 11 ----------- scripts/box/run-backup.env.sh | 13 +++++++++++++ 4 files changed, 17 insertions(+), 14 deletions(-) delete mode 100755 scripts/box/bash-aliases.sh create mode 100755 scripts/box/bash-profile.sh delete mode 100755 scripts/box/run-backup-template.sh create mode 100755 scripts/box/run-backup.env.sh (limited to 'scripts/box') diff --git a/scripts/box/bash-aliases.sh b/scripts/box/bash-aliases.sh deleted file mode 100755 index 4ef035d..0000000 --- a/scripts/box/bash-aliases.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -alias l="ls -lahp --color" diff --git a/scripts/box/bash-profile.sh b/scripts/box/bash-profile.sh new file mode 100755 index 0000000..e24d333 --- /dev/null +++ b/scripts/box/bash-profile.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +alias l="ls -lahp --color" +cd /home/vps/ diff --git a/scripts/box/run-backup-template.sh b/scripts/box/run-backup-template.sh deleted file mode 100755 index 34184b9..0000000 --- a/scripts/box/run-backup-template.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -export BORG_REMOTE_PATH="${BORG_REMOTE_PATH}" -export BORG_PASSPHRASE="${BORG_PASSPHRASE}" -borg create \ - --verbose \ - --stats \ - --progress \ - --compression lzma,6 \ - "${BORG_REPO}::{hostname}-{now}-${VPS_COMMIT_SHA}" \ - "${VOLUME_HOME}" diff --git a/scripts/box/run-backup.env.sh b/scripts/box/run-backup.env.sh new file mode 100755 index 0000000..e1ecdf0 --- /dev/null +++ b/scripts/box/run-backup.env.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +export BORG_REMOTE_PATH="${BORG_REMOTE_PATH}" +export BORG_PASSPHRASE="${BORG_PASSPHRASE}" +# The configured $BORG_REPO is already the rsync.net remote. +# No need to send the files after the backup is done. +borg create \ + --verbose \ + --stats \ + --progress \ + --compression lzma,6 \ + "${BORG_REPO}::{hostname}-{now}-${VPS_COMMIT_SHA}" \ + "${VOLUME_HOME}" -- cgit v1.2.3