Skip to content

Instantly share code, notes, and snippets.

Last active February 11, 2019 09:04
Show Gist options
  • Save martyca/b39f7b3909ddc95e75a7e5763c03c701 to your computer and use it in GitHub Desktop.
Save martyca/b39f7b3909ddc95e75a7e5763c03c701 to your computer and use it in GitHub Desktop.




VMware vSphere

Bosh repository


Workspace in ~/Development

mkdir -p  ~/Development/bosh-vsphere
cd  ~/Development/bosh-vsphere

Clone bosh repository

git clone

Deploy bosh

bosh create-env bosh-deployment/bosh.yml \
  --state=./state.json \
  --vars-store=./creds.yml \
  -o bosh-deployment/vsphere/cpi.yml \
  -v director_name=bosh-director \
  -v internal_cidr= \
  -v internal_gw= \
  -v internal_ip= \
  -v network_name= \
  -v vcenter_dc= \
  -v vcenter_ds= \
  -v vcenter_ip= \
  -v vcenter_user= \
  -v vcenter_password= \
  -v vcenter_templates= \
  -v vcenter_vms= \
  -v vcenter_disks= \
  -v vcenter_cluster=

Interpolate admin password from creds.yml

bosh int ./creds.yml --path /admin_password

Create bosh environment alias

bosh -e alias-env virtualbox --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)

Login to bosh environment

bosh -e virtualbox login

Export bosh environment to environment variable

export BOSH_ENVIRONMENT=virtualbox

Upload cloud-config

bosh update-cloud-config bosh-deployment/warden/cloud-config.yml

Download stemcell


Upload stemcell to director

bosh upload-stemcell bosh-warden-boshlite-ubuntu-trusty-go_agent

Nginx release - save this to nginx.yml

name: nginx

- name: nginx
  version: latest

- alias: ubuntu
  os: ubuntu-trusty
  version: latest

- name: nginx
  instances: 1
  azs: [ z1 ]
  vm_type: default
  stemcell: ubuntu
  - name: default
  - name: nginx
    release: nginx
      nginx_conf: |
        worker_processes  1;
        error_log /var/vcap/sys/log/nginx/error.log   info;
        events {
          worker_connections  1024;
        http {
          include /var/vcap/packages/nginx/conf/mime.types;
          default_type  application/octet-stream;
          sendfile        on;
          keepalive_timeout  65;
          server_names_hash_bucket_size 64;
          server {
            server_name demo.caarels.lab;
            listen *:80;
            access_log /var/vcap/sys/log/nginx/automate-it-access.log;
            error_log /var/vcap/sys/log/nginx/automate-it-error.log;

  canaries: 1
  max_in_flight: 1
  serial: false
  canary_watch_time: 1000-60000
  update_watch_time: 1000-60000

Deploy nginx

bosh -d nginx deploy nginx.yml

Add route (MAC-OS)

sudo route -n add -net

Add route (CentOS)

ip route add via dev eth0

Delete deployment

bosh -d nginx delete-deployment

Delete Environment

bosh delete-env bosh-deployment/bosh.yml \
  --state ./state.json \
  -o bosh-deployment/virtualbox/cpi.yml \
  -o bosh-deployment/virtualbox/outbound-network.yml \
  -o bosh-deployment/bosh-lite.yml \
  -o bosh-deployment/bosh-lite-runc.yml \
  -o bosh-deployment/jumpbox-user.yml \
  -o bosh-deployment/uaa.yml \
  -o bosh-deployment/credhub.yml \
  --vars-store ./creds.yml \
  -v director_name=VirtualBox-Director \
  -v internal_ip= \
  -v internal_gw= \
  -v internal_cidr= \
  -v outbound_network_name=NatNetwork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment