Sha256: 4cac287e787ade0fa8b6c42474231a07130c1c4e668f32c8da80f3fa34cf030b

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

require "bosh-bootstrap/microbosh_providers/base"

module Bosh::Bootstrap::MicroboshProviders
  class OpenStack < Base
    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}},
      })
    end

    def persistent_disk
      settings.bosh.persistent_disk
    end

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

    # network:
    #   name: default
    #   type: dynamic
    #   label: private
    #   ip: 1.2.3.4
    def network_configuration
      {"name"=>"default",
        "type"=>"dynamic",
        "label"=>"private",
        "ip"=>public_ip
      }
    end

    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,
        "default_security_groups"=>security_groups,
        "default_key_name"=>microbosh_name,
        "private_key"=>private_key_path}
    end

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

  end
end
Bosh::Bootstrap::MicroboshProviders.register_provider("openstack", Bosh::Bootstrap::MicroboshProviders::OpenStack)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bosh-bootstrap-0.11.2 lib/bosh-bootstrap/microbosh_providers/openstack.rb
bosh-bootstrap-0.11.1 lib/bosh-bootstrap/microbosh_providers/openstack.rb
bosh-bootstrap-0.11.0 lib/bosh-bootstrap/microbosh_providers/openstack.rb