Sha256: d28982a7469f6737510649c19b10852d05771b84de9cf83beb638bb6fad3543d

Contents?: true

Size: 943 Bytes

Versions: 9

Compression:

Stored size: 943 Bytes

Contents

command :'create host' do |c|
  c.summary = 'Create a droplet/host in your DO account'
  c.syntax = 'ops create host [DNS_name]'
  c.description = "Creates the host described in the file #{Ops::HOSTS_DIR}/[DNS_name].yml"
  c.example "Create the host example.com in your DigitalOcean console. This is described in '#{Ops::HOSTS_DIR}/example.com.yml' like:\n    #      size:     512mb\n    #      region:   ams1\n    #      image:    coreos-stable\n    #      ssh_keys:\n    #        - e7:51:47:bc:7f:dc:2f:3c:56:65:28:e1:10:9c:88:57  xx:xx:xx:xx:xx:xx:xx", 'ops create host example.com'
  c.action do |args, options|
    droplet = DigitalOcean::build_droplet args[0]
    cli = DigitalOcean::client
    resp = cli.droplets.create droplet
    if resp == droplet
      ip = cli.find_droplet_by_name(args[0]).networks["v4"].first.ip_address
      say "Droplet #{args[0]} (IP: #{ip}) succesfully created!"
    else
      raise resp
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
open-dock-0.0.10 lib/open-dock/commands/create_host.rb
prun-ops-0.0.9 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.8 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.7 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.6 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.5 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.4 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.3 lib/prun-ops/commands/create_host.rb
prun-ops-0.0.2 lib/prun-ops/commands/create_host.rb