knife-bluebox 0.8.1 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +53 -0
- data/lib/chef/knife/bluebox_flavor_list.rb +55 -0
- data/lib/chef/knife/bluebox_lb_list.rb +63 -0
- data/lib/chef/knife/bluebox_server_create.rb +9 -2
- data/lib/chef/knife/bluebox_server_list.rb +5 -1
- data/lib/knife-bluebox/version.rb +1 -1
- metadata +23 -6
- data/README.rdoc +0 -32
data/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `knife bluebox`
|
|
2
|
+
This is the official Opscode Knife plugin for [Blue Box](http://www.bluebox.net).
|
|
3
|
+
This plugin gives knife the ability to create, bootstrap, and manage Blue Box
|
|
4
|
+
servers.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
This plugin is distributed as a Ruby Gem. To install it, run:
|
|
8
|
+
|
|
9
|
+
gem install knife-bluebox
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
Set the following environmental variables in the right dotfile (typically `.profile`, `.bash_profile`, or `.zshrc`):
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
export BLUEBOX_API_KEY="YourAPIKey" # should match /[a-f0-9]+/
|
|
16
|
+
export BLUEBOX_CUSTOMER_ID="YourCustomerNumber" # should match /d+/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then in your chef repository's `.chef/knife.rb`, set
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
knife[:bluebox_customer_id] = ENV['BLUEBOX_CUSTOMER_ID']
|
|
23
|
+
knife[:bluebox_api_key] = ENV['BLUEBOX_API_KEY']
|
|
24
|
+
knife[:identity_file] = "#{ENV['HOME']}/.ssh/id_rsa"
|
|
25
|
+
knife[:public_identity_file] = "#{ENV['HOME']}/.ssh/id_rsa.pub"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
You will need to run knife from within your chef repo to have the knife.rb config take effect.
|
|
29
|
+
|
|
30
|
+
## Usage and subcommands
|
|
31
|
+
For a complete list of options for each command, use `knife bluebox SUBCOMMAND ACTION --help`.
|
|
32
|
+
|
|
33
|
+
### knife bluebox flavor list
|
|
34
|
+
Show available block types and associated UUIDs.
|
|
35
|
+
|
|
36
|
+
### knife bluebox image \[create|delete|list\] \[options\]
|
|
37
|
+
Manipulate and display stored block images.
|
|
38
|
+
* `knife bluebox create UUID` creates a new machine image from the server specified by `UUID`.
|
|
39
|
+
* `--public` will make the machine image public for other blocks users to deploy from.
|
|
40
|
+
* `--description` provides a description for the image. Default is machine hostname and
|
|
41
|
+
timestamp.
|
|
42
|
+
|
|
43
|
+
### knife bluebox lb list
|
|
44
|
+
Show list of Blocks Load Balancer applications and each application's load balanced services.
|
|
45
|
+
|
|
46
|
+
### knife bluebox server create \[RUN LIST...\] (options)
|
|
47
|
+
Create a new block instance.
|
|
48
|
+
|
|
49
|
+
### knife bluebox server delete HOSTNAME
|
|
50
|
+
Delete block instance specified by _HOSTNAME_.
|
|
51
|
+
|
|
52
|
+
### knife bluebox server list (options)
|
|
53
|
+
List all blocks currently running on the account.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Author:: Jesse Proudman (<jesse.proudman@blueboxgrp.com>)
|
|
3
|
+
# Copyright:: Copyright (c) 2010 Blue Box Group
|
|
4
|
+
# License:: Apache License, Version 2.0
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
require 'chef/knife'
|
|
20
|
+
|
|
21
|
+
class Chef
|
|
22
|
+
class Knife
|
|
23
|
+
class BlueboxFlavorList < Knife
|
|
24
|
+
|
|
25
|
+
deps do
|
|
26
|
+
require 'fog'
|
|
27
|
+
require 'highline'
|
|
28
|
+
require 'readline'
|
|
29
|
+
require 'chef/json_compat'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
banner "knife bluebox flavor list"
|
|
33
|
+
|
|
34
|
+
def h
|
|
35
|
+
@highline ||= HighLine.new
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def run
|
|
39
|
+
bluebox = Fog::Compute::Bluebox.new(
|
|
40
|
+
:bluebox_customer_id => Chef::Config[:knife][:bluebox_customer_id],
|
|
41
|
+
:bluebox_api_key => Chef::Config[:knife][:bluebox_api_key]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
flavor_list = [ h.color('ID', :bold), h.color('Description', :bold) ]
|
|
45
|
+
|
|
46
|
+
bluebox.flavors.each do |flavor|
|
|
47
|
+
flavor_list << flavor.id.to_s
|
|
48
|
+
flavor_list << flavor.description
|
|
49
|
+
end
|
|
50
|
+
puts h.list(flavor_list, :columns_across, 2)
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Author:: Joshua Yotty (<jyotty@bluebox.net>)
|
|
3
|
+
# Copyright:: Copyright (c) 2013 Blue Box Group
|
|
4
|
+
# License:: Apache License, Version 2.0
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
require 'chef/knife'
|
|
20
|
+
|
|
21
|
+
class Chef
|
|
22
|
+
class Knife
|
|
23
|
+
class BlueboxLbList < Knife
|
|
24
|
+
|
|
25
|
+
deps do
|
|
26
|
+
require 'fog'
|
|
27
|
+
require 'highline'
|
|
28
|
+
require 'readline'
|
|
29
|
+
require 'chef/json_compat'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
banner "knife bluebox lb list"
|
|
33
|
+
|
|
34
|
+
def h
|
|
35
|
+
@highline ||= HighLine.new
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def run
|
|
39
|
+
blb = Fog::Bluebox::BLB.new(
|
|
40
|
+
:bluebox_customer_id => Chef::Config[:knife][:bluebox_customer_id],
|
|
41
|
+
:bluebox_api_key => Chef::Config[:knife][:bluebox_api_key]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
blb.lb_applications.each_with_index do |application, index|
|
|
45
|
+
puts if index != 0
|
|
46
|
+
lines = []
|
|
47
|
+
|
|
48
|
+
lines << [ 'Application ID', 'Name', 'IP addresses'].map {|s| h.color(s, :bold)}
|
|
49
|
+
lines << [ application.id, application.name, application.ip_v4, nil, nil, application.ip_v6 ]
|
|
50
|
+
unless application.lb_services.empty?
|
|
51
|
+
lines << [ 'Service ID', 'Service Type', 'Port'].map {|s| h.color(s, :bold)}
|
|
52
|
+
application.lb_services.each do |service|
|
|
53
|
+
lines << [ service.id, service.service_type, service.port.to_s ]
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
lines.flatten!
|
|
57
|
+
puts h.list(lines, :uneven_columns_across, 3)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -126,9 +126,11 @@ class Chef
|
|
|
126
126
|
|
|
127
127
|
puts "#{h.color("Deploying a new Blue Box Block...", :green)}\n\n"
|
|
128
128
|
|
|
129
|
+
image_id = Chef::Config[:knife][:image] || config[:image]
|
|
130
|
+
|
|
129
131
|
server = bluebox.servers.new(
|
|
130
132
|
:flavor_id => Chef::Config[:knife][:flavor] || config[:flavor],
|
|
131
|
-
:image_id =>
|
|
133
|
+
:image_id => image_id,
|
|
132
134
|
:hostname => config[:chef_node_name],
|
|
133
135
|
:username => Chef::Config[:knife][:username] || config[:username],
|
|
134
136
|
:password => config[:password],
|
|
@@ -136,7 +138,12 @@ class Chef
|
|
|
136
138
|
:lb_applications => Chef::Config[:knife][:load_balancer] || config[:load_balancer]
|
|
137
139
|
)
|
|
138
140
|
|
|
139
|
-
|
|
141
|
+
begin
|
|
142
|
+
response = server.save
|
|
143
|
+
rescue Fog::Compute::Bluebox::NotFound
|
|
144
|
+
puts "#{h.color("Could not locate an image with uuid #{image_id}.\n", :red)}"
|
|
145
|
+
exit 1
|
|
146
|
+
end
|
|
140
147
|
|
|
141
148
|
# Wait for the server to start
|
|
142
149
|
begin
|
|
@@ -50,7 +50,11 @@ class Chef
|
|
|
50
50
|
bluebox.servers.each do |server|
|
|
51
51
|
server_list << server.id.to_s
|
|
52
52
|
server_list << server.hostname
|
|
53
|
-
|
|
53
|
+
if server.ips[0] && server.ips[0]["address"]
|
|
54
|
+
server_list << server.ips[0]["address"]
|
|
55
|
+
else
|
|
56
|
+
server_list << ""
|
|
57
|
+
end
|
|
54
58
|
end
|
|
55
59
|
puts h.list(server_list, :columns_across, 3)
|
|
56
60
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knife-bluebox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-
|
|
13
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: chef
|
|
@@ -35,7 +35,7 @@ dependencies:
|
|
|
35
35
|
requirements:
|
|
36
36
|
- - ~>
|
|
37
37
|
- !ruby/object:Gem::Version
|
|
38
|
-
version:
|
|
38
|
+
version: 1.10.0
|
|
39
39
|
type: :runtime
|
|
40
40
|
prerelease: false
|
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -43,20 +43,37 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - ~>
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 1.10.0
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: highline
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
none: false
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.6.9
|
|
55
|
+
type: :runtime
|
|
56
|
+
prerelease: false
|
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
59
|
+
requirements:
|
|
60
|
+
- - ~>
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 1.6.9
|
|
47
63
|
description: Chef knife plugin for Blue Box
|
|
48
64
|
email: support@bluebox.net
|
|
49
65
|
executables: []
|
|
50
66
|
extensions: []
|
|
51
67
|
extra_rdoc_files:
|
|
52
|
-
- README.rdoc
|
|
53
68
|
- LICENSE
|
|
54
69
|
files:
|
|
55
70
|
- LICENSE
|
|
56
|
-
- README.
|
|
71
|
+
- README.md
|
|
72
|
+
- lib/chef/knife/bluebox_flavor_list.rb
|
|
57
73
|
- lib/chef/knife/bluebox_image_create.rb
|
|
58
74
|
- lib/chef/knife/bluebox_image_delete.rb
|
|
59
75
|
- lib/chef/knife/bluebox_image_list.rb
|
|
76
|
+
- lib/chef/knife/bluebox_lb_list.rb
|
|
60
77
|
- lib/chef/knife/bluebox_server_create.rb
|
|
61
78
|
- lib/chef/knife/bluebox_server_delete.rb
|
|
62
79
|
- lib/chef/knife/bluebox_server_list.rb
|
data/README.rdoc
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
= Knife Blue Box
|
|
2
|
-
This is the official Opscode Knife plugin for {Blue Box}[http://www.bluebox.net].
|
|
3
|
-
This plugin gives knife the ability to create, bootstrap, and manage Blue Box
|
|
4
|
-
servers.
|
|
5
|
-
|
|
6
|
-
== Installation
|
|
7
|
-
This plugin is distributed as a Ruby Gem. To install it, run:
|
|
8
|
-
gem install knife-bluebox
|
|
9
|
-
Depending on your system configuration, you may need to run this command with
|
|
10
|
-
root privileges.
|
|
11
|
-
|
|
12
|
-
== Configuration
|
|
13
|
-
Set the following environmental variables
|
|
14
|
-
|
|
15
|
-
export BLUEBOX_API_KEY="YourAPIKey" # should match /[a-f0-9]+/
|
|
16
|
-
export BLUEBOX_CUSTOMER_ID="YourCustomerNumber" # should match /d+/
|
|
17
|
-
|
|
18
|
-
Then add the following lines to <chef-repo-root>/.chef/knife.rb
|
|
19
|
-
|
|
20
|
-
# API credentials for knife-bluebox
|
|
21
|
-
knife[:bluebox_customer_id] = ENV['BLUEBOX_CUSTOMER_ID']
|
|
22
|
-
knife[:bluebox_api_key] = ENV['BLUEBOX_API_KEY']
|
|
23
|
-
knife[:identity_file] = "#{ENV['HOME']}/.ssh/id_rsa"
|
|
24
|
-
knife[:public_identity_file] = "#{ENV['HOME']}/.ssh/id_rsa.pub"
|
|
25
|
-
|
|
26
|
-
== Usage
|
|
27
|
-
knife bluebox images list
|
|
28
|
-
knife bluebox server create [RUN LIST...] (options)
|
|
29
|
-
knife bluebox server delete BLOCK-HOSTNAME
|
|
30
|
-
knife bluebox server list (options)
|
|
31
|
-
|
|
32
|
-
You will need to run knife from within your chef-repo to have the knife.rb config take effect.
|