Class: Bosh::Bootstrap::MicroboshProviders::VSphere

Inherits:
Base
  • Object
show all
Defined in:
lib/bosh-bootstrap/microbosh_providers/vsphere.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_NTP_SERVERS

Instance Attribute Summary

Attributes inherited from Base

#fog_compute, #manifest_path, #settings

Instance Method Summary collapse

Methods inherited from Base

#create_microbosh_yml, #default_spec, #discover_if_stemcell_image_already_uploaded, #download_stemcell, #initialize, #jenkins_bucket, #microbosh_name, #ntp_servers, #private_key_path, #proxy, #proxy?, #public_ip, #public_ip?, #recent_stemcells, #salted_password, #stemcell_dir, #stemcell_path

Constructor Details

This class inherits a constructor from Bosh::Bootstrap::MicroboshProviders::Base

Instance Method Details

#latest_stemcellObject

Returns Bosh::Cli::PublicStemcell latest stemcell for vsphere/trusty.

Returns:

  • Bosh::Cli::PublicStemcell latest stemcell for vsphere/trusty



97
98
99
100
101
102
103
104
# File 'lib/bosh-bootstrap/microbosh_providers/vsphere.rb', line 97

def latest_stemcell
  @latest_stemcell ||= begin
    trusty_stemcells = recent_stemcells.select do |s|
      s.name =~ /vsphere/ && s.name =~ /trusty/
    end
    trusty_stemcells.sort {|s1, s2| s2.version <=> s1.version}.first
  end
end

#network_configurationObject

network:

ip: 172.23.194.100
netmask: 255.255.254.0
gateway: 172.23.194.1
dns:
- 172.22.22.153
- 172.22.22.154
cloud_properties:
  name: VLAN2194


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bosh-bootstrap/microbosh_providers/vsphere.rb', line 31

def network_configuration
  dns = settings.provider.network.dns
  dns = dns.split(",") if dns.is_a?(String)
  {
    "ip"=>public_ip,
    "netmask"=>settings.provider.network.netmask,
    "gateway"=>settings.provider.network.gateway,
    "dns"=>dns,
    "cloud_properties"=>{
      "name"=>settings.provider.network.name
    }
  }
end

#resource_configurationObject

resources:

persistent_disk: 32768
cloud_properties:
  ram: 4096
  disk: 10240
  cpu: 2


51
52
53
54
55
56
57
58
59
60
# File 'lib/bosh-bootstrap/microbosh_providers/vsphere.rb', line 51

def resource_configuration
  {
    "persistent_disk"=>settings.provider.resources.persistent_disk,
    "cloud_properties"=>{
      "ram"=>settings.provider.resources.ram,
      "disk"=>settings.provider.resources.disk,
      "cpu"=>settings.provider.resources.cpu
    }
  }
end

#stemcellObject



5
6
7
8
9
# File 'lib/bosh-bootstrap/microbosh_providers/vsphere.rb', line 5

def stemcell
  unless settings.exists?("bosh.stemcell")
    download_stemcell
  end
end

#to_hashObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/bosh-bootstrap/microbosh_providers/vsphere.rb', line 11

def to_hash
  super.deep_merge({
    "network" => network_configuration,
    "resources" => resource_configuration,
    "cloud"=>
     {"plugin"=>"vsphere",
      "properties"=>{
        "vcenters"=>[vcenter_configuration]
      }}})
end

#vcenter_configurationObject

vcenters:

  • host: HOST user: devcloudfoundry-auth password: TempP@ss datacenters:

    - name: LAS01
      vm_folder: BOSH_VMs
      template_folder: BOSH_Templates
      disk_path: BOSH_Deployer
      datastore_pattern: las01-.*
      persistent_datastore_pattern: las01-.*
      allow_mixed_datastores: true
      clusters:
      - CLUSTER01
    


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/bosh-bootstrap/microbosh_providers/vsphere.rb', line 76

def vcenter_configuration
  clusters = settings.provider.datacenter.clusters
  clusters = clusters.split(",") if clusters.is_a?(String)
  {
    "host"=>settings.provider.credentials.vsphere_server,
    "user"=>settings.provider.credentials.vsphere_username,
    "password"=>settings.provider.credentials.vsphere_password,
    "datacenters"=>[{
      "name"=>settings.provider.datacenter.name,
      "vm_folder"=>settings.provider.datacenter.vm_folder,
      "template_folder"=>settings.provider.datacenter.template_folder,
      "disk_path"=>settings.provider.datacenter.disk_path,
      "datastore_pattern"=>settings.provider.datacenter.datastore_pattern,
      "persistent_datastore_pattern"=>settings.provider.datacenter.persistent_datastore_pattern,
      "allow_mixed_datastores"=>settings.provider.datacenter.allow_mixed_datastores,
      "clusters"=>clusters
    }]
  }
end