Skip to content

Instantly share code, notes, and snippets.

@LinuxBozo
Last active April 12, 2018 18:41
Show Gist options
  • Save LinuxBozo/bdae29aafc8d37102dca0a5d30ee3f50 to your computer and use it in GitHub Desktop.
Save LinuxBozo/bdae29aafc8d37102dca0a5d30ee3f50 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
BOSH_DEPLOYMENT_PATH="../../bosh-deployment"
# clean up
(cd "$BOSH_DEPLOYMENT_PATH" && git pull)
rm -rf state.json
for uuid in $(VBoxManage list vms|grep -E ^\"sc- | awk '{print $2}' | sed 's/{//' | sed 's/}//'); do
VBoxManage controlvm "$uuid" poweroff || true
VBoxManage unregistervm "$uuid" --delete
done
for uuid in $(VBoxManage list vms|grep -E ^\"vm- | awk '{print $2}' | sed 's/{//' | sed 's/}//'); do
VBoxManage controlvm "$uuid" poweroff || true
VBoxManage unregistervm "$uuid" --delete
done
# create bosh-lite instance
bosh create-env "$BOSH_DEPLOYMENT_PATH"/bosh.yml \
--state ./state.json \
-o "$BOSH_DEPLOYMENT_PATH"/virtualbox/cpi.yml \
-o "$BOSH_DEPLOYMENT_PATH"/virtualbox/outbound-network.yml \
-o "$BOSH_DEPLOYMENT_PATH"/bosh-lite.yml \
-o "$BOSH_DEPLOYMENT_PATH"/bosh-lite-runc.yml \
-o "$BOSH_DEPLOYMENT_PATH"/jumpbox-user.yml \
--vars-store ./creds.yml \
-v director_name="Bosh Lite Director" \
-v internal_ip=192.168.50.6 \
-v internal_gw=192.168.50.1 \
-v internal_cidr=192.168.50.0/24 \
-v outbound_network_name=NatNetwork
# login
bosh alias-env vbox -e 192.168.50.6 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)
export BOSH_CLIENT=admin
BOSH_CLIENT_SECRET=$(bosh int ./creds.yml --path /admin_password)
export BOSH_CLIENT_SECRET
# prepare the director
bosh -e vbox -n update-cloud-config "$BOSH_DEPLOYMENT_PATH"/warden/cloud-config.yml
bosh -e vbox upload-stemcell https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent
# setup networking
sudo route add -net 10.244.0.0/16 192.168.50.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment