Class: Chef::Knife::ServerBootstrapLinode

Inherits:
Chef::Knife
  • Object
show all
Includes:
ServerBootstrapBase
Defined in:
lib/chef/knife/server_bootstrap_linode.rb

Overview

Provisions a Linode instance and sets up an Open Source Chef Server.

Instance Method Summary collapse

Methods included from ServerBootstrapBase

included

Instance Method Details

#linode_bootstrapObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/chef/knife/server_bootstrap_linode.rb', line 62

def linode_bootstrap
  ENV["WEBUI_PASSWORD"] = config_val(:webui_password)
  ENV["AMQP_PASSWORD"] = config_val(:amqp_password)
  ENV["NO_TEST"] = "1" if config[:no_test]
  bootstrap = Chef::Knife::LinodeServerCreate.new
  Chef::Knife::LinodeServerCreate.options.keys.each do |attr|
    val = config_val(attr)
    next if val.nil?

    bootstrap.config[attr] = val
  end
  bootstrap.config[:distro] = bootstrap_distro
  bootstrap
end

#linode_connectionObject



77
78
79
80
81
82
# File 'lib/chef/knife/server_bootstrap_linode.rb', line 77

def linode_connection
  @linode_connection ||= Fog::Compute.new(
    :provider => "Linode",
    :linode_api_key => config_val(:linode_api_key)
  )
end

#runObject



54
55
56
57
58
59
60
# File 'lib/chef/knife/server_bootstrap_linode.rb', line 54

def run
  super
  linode_bootstrap.run
  fetch_validation_key
  create_root_client
  install_client_key
end

#server_ip_addressObject



84
85
86
87
88
89
90
# File 'lib/chef/knife/server_bootstrap_linode.rb', line 84

def server_ip_address
  server = linode_connection.servers.find do |s|
    s.status == 1 && s.name == config_val(:linode_node_name)
  end

  server && server.public_ip_address
end