Class: Chef::Knife::ServerBootstrapDigitalocean
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ServerBootstrapDigitalocean
- Includes:
- ServerBootstrapBase
- Defined in:
- lib/chef/knife/server_bootstrap_digitalocean.rb
Overview
Provisions a Digital Ocean instance and sets up an Open Source Chef Server.
Instance Method Summary collapse
- #digital_ocean_bootstrap ⇒ Object
- #digital_ocean_connection ⇒ Object
- #run ⇒ Object
- #server_ip_address ⇒ Object
Methods included from ServerBootstrapBase
Instance Method Details
#digital_ocean_bootstrap ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/chef/knife/server_bootstrap_digitalocean.rb', line 83 def digital_ocean_bootstrap setup_environment bootstrap = Chef::Knife::DigitalOceanDropletCreate.new bootstrap.config[:bootstrap] = true Chef::Knife::DigitalOceanDropletCreate..keys.each do |attr| val = config_val(attr) next if val.nil? bootstrap.config[attr] = val end bootstrap.config[:server_name] = config_val(:chef_node_name) bootstrap.config[:distro] = bootstrap_distro bootstrap end |
#digital_ocean_connection ⇒ Object
98 99 100 101 102 |
# File 'lib/chef/knife/server_bootstrap_digitalocean.rb', line 98 def digital_ocean_connection @digital_ocean_connection ||= DropletKit::Client.new( :access_token => config_val(:digital_ocean_access_token) ) end |
#run ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/chef/knife/server_bootstrap_digitalocean.rb', line 75 def run super digital_ocean_bootstrap.run fetch_validation_key create_root_client install_client_key end |
#server_ip_address ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/chef/knife/server_bootstrap_digitalocean.rb', line 104 def server_ip_address server = digital_ocean_connection.droplets.all.find do |s| s.status == "active" && s.name == config_val(:chef_node_name) end server && server.public_ip end |