summaryrefslogtreecommitdiff
path: root/env/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'env/setup.sh')
-rwxr-xr-xenv/setup.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/env/setup.sh b/env/setup.sh
new file mode 100755
index 0000000..7071d6b
--- /dev/null
+++ b/env/setup.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -eu -o pipefail
+
+# Get the Debian 10 (buster) OpenStack cloud image. We use it as a
+# base image for creating the VMs we need.
+
+url="https://cloud.debian.org/images/cloud/OpenStack/current-10/debian-10-openstack-amd64.qcow2"
+image=debian-10-openstack-amd64.qcow2
+if [ ! -e "files/$image" ]
+then
+ echo "Download Debian cloud image (only happens on first run)"
+ wget -q -c -O "files/$image" "$url"
+fi
+
+# git does not preserve file modes properly, so set the permissions of
+# the SSH keys we're using so the the SSH client is happy.
+chmod 600 ssh/ed25519*
+
+echo "Provision outer VM"
+chronic ansible-playbook -i hosts playbook.yml
+
+echo "Create and provision the inner VMs"
+ssh -F ssh/config puomi@puomienv ./setup-inner.sh
+
+# Disable network forwarding in outer VM. This can't be done until the
+# inner VMs are provisioned, or they can't install anything.
+ssh debian@puomienv sudo sysctl -w net.ipv4.ip_forward=0
+
+echo "Finished; the router test environment is ready for use"