Note: See Creating environment on vSphere with CLI v2. (Recommended)

This document shows how to initialize new environment on vSphere.

Step 1: Create a Deployment Manifest

  1. Create a deployment directory.

    $ mkdir ~/my-bosh
    
  2. Create a deployment manifest file named bosh.yml in the deployment directory based on the template below.

    Note: The example below uses several predefined passwords. We recommend replacing them with passwords of your choice.

---
name: bosh

releases:
- name: bosh
  url: https://bosh.io/d/github.com/cloudfoundry/bosh?v=263
  sha1: cb3f6a1f1880b2883e04bd6a5d6fd0cb9af87fa1
- name: bosh-vsphere-cpi
  url: https://bosh.io/d/github.com/cloudfoundry-incubator/bosh-vsphere-cpi-release?v=43
  sha1: f9f2b4019d69fcabb0df4ba1ce74964f5c27e28c

resource_pools:
- name: vms
  network: private
  stemcell:
    url: https://bosh.io/d/stemcells/bosh-vsphere-esxi-ubuntu-trusty-go_agent?v=3445.2
    sha1: 34b06740d6804a491316185973c4b77c86b45e5c
  cloud_properties:
    cpu: 2
    ram: 4_096
    disk: 20_000
  env:
    bosh:
      # c1oudc0w is a default password for vcap user
      password: "$6$4gDD3aV0rdqlrKC$2axHCxGKIObs6tAmMTqYCspcdvQXh3JJcvWOY2WGb4SrdXtnCyNaWlrf3WEqvYR2MYizEGp3kMmbpwBC6jsHt0"

disk_pools:
- name: disks
  disk_size: 20_000

networks:
- name: private
  type: manual
  subnets:
  - range: 10.0.0.0/24
    gateway: 10.0.0.1
    dns: [10.0.0.2]
    cloud_properties: {name: NETWORK-NAME} # <--- Replace with Network name

jobs:
- name: bosh
  instances: 1

  templates:
  - {name: nats, release: bosh}
  - {name: postgres, release: bosh}
  - {name: blobstore, release: bosh}
  - {name: director, release: bosh}
  - {name: health_monitor, release: bosh}
  - {name: vsphere_cpi, release: bosh-vsphere-cpi}

  resource_pool: vms
  persistent_disk_pool: disks

  networks:
  - {name: private, static_ips: [10.0.0.6]}

  properties:
    nats:
      address: 127.0.0.1
      user: nats
      # password: nats-password # <--- Uncomment & change

    postgres: &db
      listen_address: 127.0.0.1
      host: 127.0.0.1
      user: postgres
      # password: postgres-password # <--- Uncomment & change
      database: bosh
      adapter: postgres

    blobstore:
      address: 10.0.0.6
      port: 25250
      provider: dav
      director:
        user: director
        # password: director-password # <--- Uncomment & change
      agent:
        user: agent
        # password: agent-password # <--- Uncomment & change

    director:
      address: 127.0.0.1
      name: my-bosh
      db: *db
      cpi_job: vsphere_cpi
      user_management:
        provider: local
        local:
          users:
          # - {name: admin, password: admin} # <--- Uncomment & change
          # - {name: hm, password: hm-password} # <--- Uncomment & change

    hm:
      director_account:
        user: hm
        # password: hm-password # <--- Uncomment & change
      resurrector_enabled: true
      intervals:
        agent_timeout: 180

    vcenter: &vcenter # <--- Replace values below
      address: VCENTER-IP
      user: VCENTER-USER
      password: VCENTER-PASSWORD
      datacenters:
      - name: DATACENTER-NAME
        vm_folder: VMS-FOLDER-NAME
        template_folder: TEMPLATES-FOLDER-NAME
        datastore_pattern: DATASTORE-NAME-PATTERN
        persistent_datastore_pattern: DATASTORE-NAME-PATTERN
        disk_path: DISK-FOLDER-NAME
        clusters: [CLUSTER-NAME]

    # agent: {mbus: "nats://nats:nats-password@10.0.0.6:4222"} # <--- Uncomment & change

    ntp: &ntp [0.pool.ntp.org, 1.pool.ntp.org]

cloud_provider:
  template: {name: vsphere_cpi, release: bosh-vsphere-cpi}

  # mbus: "https://mbus:mbus-password@10.0.0.6:6868" # <--- Uncomment & change

  properties:
    vcenter: *vcenter
    # agent: {mbus: "https://mbus:mbus-password@0.0.0.0:6868"} # <--- Uncomment & change
    blobstore: {provider: local, path: /var/vcap/micro_bosh/data/cache}
    ntp: *ntp

Step 2: Prepare a vSphere Environment

To prepare your vSphere environment, use the vSphere Web Client to find out and/or create any missing resources listed below:

  • Replace VCENTER-IP (e.g. ‘192.168.0.10’) with the IP of the vCenter.

  • Replace VCENTER-USER (e.g. 'root’) and VCENTER-PASSWORD (e.g. 'vmware’) in your deployment manifest with vCenter user name and password. BOSH does not require user to be an admin, but it does require the following privileges.

  • Replace DATACENTER-NAME (e.g. 'my-dc’) with the name of the datacenter the Director will use for VM creation.

  • Replace VMS-FOLDER-NAME (e.g. 'my-bosh-vms’) and TEMPLATES-FOLDER-NAME (e.g. 'my-bosh-templates’) with the name of the folder created to hold VMs and the name of the folder created to hold stemcells. Folders will be automatically created under the chosen datacenter.

  • Replace DATASTORE-NAME-PATTERN (e.g. 'datastore[1-9]’) with a regex matching the names of potential datastores the Director will use for storing VMs and associated persistent disks.

  • Replace DISK-FOLDER-NAME (e.g. 'my-bosh-disks’) with the name of the VMs folder. Disk folder will be automatically created in the chosen datastore.

  • Replace CLUSTER-NAME (e.g. 'cluster1’) with the name of the vSphere cluster. Create cluster under the chosen datacenter in the Clusters tab.

  • Replace NETWORK-NAME (e.g. 'VM Network’) with the name of the vSphere network. Create network under the chosen datacenter in the Networks tab. Deployment manifest assumes that this network is 10.0.0.0/24 and Director VM will be placed at 10.0.0.6.


Step 3: Deploy

Note: See Migrating to bosh-init from the micro CLI plugin if you have an existing MicroBOSH.

  1. Install bosh-init.

  2. Run bosh-init deploy ./bosh.yml to start the deployment process.

    $ bosh-init deploy ./bosh.yml
    ...
    

    See vSphere CPI errors for list of common errors and resolutions.

  3. Install the BOSH Command Line Interface (CLI).

  4. Use bosh target 10.0.0.6 to log into your new BOSH Director. The default username and password are admin and admin.

    $ bosh target 10.0.0.6
    
    Target set to 'bosh'
    Your username: admin
    Enter password: *****
    Logged in as 'admin'
    
    $ bosh vms
    
    No deployments
    
  5. Save the deployment state file left in your deployment directory so you can later update/delete your Director. See Deployment state section of 'Using bosh-init’ for more details.


Back to Table of Contents

Previous: Bootstrapping an environment


Contribute changes to this page