aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap.sh28
1 files changed, 13 insertions, 15 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 242f184..18404f0 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -13,23 +13,21 @@ echo "Playbook: ${PLAYBOOK}"
SSHDIR="${ROOTDIR}/private/ssh"
SSHKEY="${SSHDIR}/ansible.key"
-if [ -f "${SSHKEY}" ]; then
- echo "ERROR: SSH key already exists: ${SSHKEY}"
- echo "Target machine already been bootstrapped?"
-else
+if [ ! -f "${SSHKEY}" ]; then
[ ! -d "${SSHDIR}" ] && mkdir -v "${SSHDIR}"
echo "Generating SSH key ..."
ssh-keygen -t ed25519 -C "ansible" -f "${SSHKEY}"
echo "Generated SSH key: ${SSHKEY}"
- echo "Bootstrap target by installing Python ..."
- ansible vultr -u root \
- -m raw -a "pkg update; pkg install -y python3"
- ansible-playbook \
- --verbose --diff \
- --ask-pass --ask-become-pass \
- "${PLAYBOOK}"
- echo "Bootstrapped the target machine!"
- ansible vultr -u ansible -m ping
- ansible vultr -u ansible -m command -a whoami
- ansible vultr -u ansible -m command -a whoami -b
fi
+
+echo "Bootstrap target by installing Python ..."
+ansible vultr -u root \
+ -m raw -a "pkg update; pkg install -y python3"
+ansible-playbook \
+ --verbose --diff \
+ --ask-pass --ask-become-pass \
+ "${PLAYBOOK}"
+echo "Bootstrapped the target machine!"
+ansible vultr -u ansible -m ping
+ansible vultr -u ansible -m command -a whoami
+ansible vultr -u ansible -m command -a whoami --become