summaryrefslogtreecommitdiff
path: root/env/setup.sh
blob: 7071d6bf601f55b987cba7348c410a4e6d676b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"