Skip to content

Instantly share code, notes, and snippets.

@luan
Created December 12, 2017 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luan/d9c055616705dc17a0f3254e93525d62 to your computer and use it in GitHub Desktop.
Save luan/d9c055616705dc17a0f3254e93525d62 to your computer and use it in GitHub Desktop.
Create bare VM from stemcell in virtualbox
#!/bin/bash
WORKSPACE=$HOME/workspace/src/github.com/cloudfoundry
STEMCELL_PATH=${STEMCELL_PATH:-$WORKSPACE/bosh-linux-stemcell-builder/tmp/bosh-stemcell-0000-vsphere-esxi-centos-7-go_agent.tgz}
bosh create-env --recreate dummy.yml \
--state ./state.json \
-o $WORKSPACE/bosh-deployment/virtualbox/cpi.yml \
-o $WORKSPACE/bosh-deployment/virtualbox/outbound-network.yml \
-o <(echo '[{ type: "replace", path: "/resource_pools/name=vms/stemcell?", value: { url: "file://((stemcell_path))" } }]') \
--vars-store ./creds.yml \
-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 \
-v stemcell_path=$STEMCELL_PATH \
---
name: bosh
releases:
- name: os-conf
version: 18
url: https://bosh.io/d/github.com/cloudfoundry/os-conf-release?v=18
sha1: 78d79f08ff5001cc2a24f572837c7a9c59a0e796
resource_pools:
- name: vms
network: default
env:
bosh:
password: '*'
mbus:
cert: ((mbus_bootstrap_ssl))
disk_pools:
- name: disks
disk_size: 32_768
networks:
- name: default
type: manual
subnets:
- range: ((internal_cidr))
gateway: ((internal_gw))
static: [((internal_ip))]
dns: [8.8.8.8]
instance_groups:
- name: bosh
instances: 1
jobs:
- name: user_add
release: os-conf
properties:
users:
- name: jumpbox
public_key: ((jumpbox_ssh.public_key))
resource_pool: vms
persistent_disk_pool: disks
networks:
- name: default
static_ips: [((internal_ip))]
properties:
director: {}
cloud_provider:
mbus: https://mbus:((mbus_bootstrap_password))@((internal_ip)):6868
cert: ((mbus_bootstrap_ssl))
properties:
agent: {mbus: "https://mbus:((mbus_bootstrap_password))@0.0.0.0:6868"}
blobstore: {provider: local, path: /var/vcap/micro_bosh/data/cache}
ntp:
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
variables:
- name: mbus_bootstrap_password
type: password
- name: jumpbox_ssh
type: ssh
- name: default_ca
type: certificate
options:
is_ca: true
common_name: ca
- name: mbus_bootstrap_ssl
type: certificate
options:
ca: default_ca
common_name: ((internal_ip))
alternative_names: [((internal_ip))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment