Class: Bosh::Bootstrap::MicroboshProviders::OpenStack

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

Instance Attribute Summary

Attributes inherited from Base

#manifest_path, #settings

Instance Method Summary collapse

Methods inherited from Base

#create_microbosh_yml, #download_stemcell, #initialize, #jenkins_bucket, #microbosh_name, #private_key_path, #public_ip, #salted_password, #stemcell_dir

Constructor Details

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

Instance Method Details

#cloud_propertiesObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 45

def cloud_properties
  {
    "auth_url"=>settings.provider.credentials.openstack_auth_url,
    "username"=>settings.provider.credentials.openstack_username,
    "api_key"=>settings.provider.credentials.openstack_api_key,
    "tenant"=>settings.provider.credentials.openstack_tenant,
    "region"=>region,
    "default_security_groups"=>security_groups,
    "default_key_name"=>microbosh_name,
    "private_key"=>private_key_path}
end

#network_configurationObject

network:

type: dynamic
ip: 1.2.3.4


31
32
33
34
35
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 31

def network_configuration
  {"type"=>"dynamic",
    "vip"=>public_ip
  }
end

#persistent_diskObject



37
38
39
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 37

def persistent_disk
  settings.bosh.persistent_disk
end

#regionObject



57
58
59
60
61
62
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 57

def region
  if settings.provider.credentials.openstack_region && !settings.provider.credentials.openstack_region.empty?
   return settings.provider.credentials.openstack_region
  end
  nil
end

#resources_cloud_propertiesObject



41
42
43
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 41

def resources_cloud_properties
  {"instance_type"=>"m1.medium"}
end

#security_groupsObject



64
65
66
67
68
69
70
71
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 64

def security_groups
  ["ssh",
   "bosh_agent_http",
   "bosh_nats_server",
   "bosh_blobstore",
   "bosh_director",
   "bosh_registry"]
end

#stemcellObject



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

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

#stemcell_uriObject



73
74
75
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 73

def stemcell_uri
  "http://#{jenkins_bucket}.s3.amazonaws.com/last_successful_micro-bosh-stemcell-openstack.tgz"
end

#to_hashObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 11

def to_hash
  super.merge({
   "network"=>network_configuration,
   "resources"=>
    {"persistent_disk"=>persistent_disk,
     "cloud_properties"=>resources_cloud_properties},
   "cloud"=>
    {"plugin"=>"openstack",
     "properties"=>
      {"openstack"=>cloud_properties}},
   "apply_spec"=>
    {"agent"=>
      {"blobstore"=>{"address"=>public_ip},
       "nats"=>{"address"=>public_ip}}}
  })
end