knife-rackspace 0.11.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.github/ISSUE_TEMPLATE.md +21 -0
- data/.travis.yml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +8 -1
- data/README.md +230 -0
- data/Rakefile +18 -18
- data/knife-rackspace.gemspec +7 -11
- data/lib/chef/knife/rackspace_base.rb +28 -28
- data/lib/chef/knife/rackspace_flavor_list.rb +17 -17
- data/lib/chef/knife/rackspace_image_list.rb +5 -5
- data/lib/chef/knife/rackspace_network_create.rb +4 -4
- data/lib/chef/knife/rackspace_network_delete.rb +2 -2
- data/lib/chef/knife/rackspace_network_list.rb +4 -4
- data/lib/chef/knife/rackspace_server_create.rb +78 -81
- data/lib/chef/knife/rackspace_server_delete.rb +8 -8
- data/lib/chef/knife/rackspace_server_list.rb +19 -15
- data/lib/knife-rackspace/version.rb +2 -2
- data/spec/integration_spec_helper.rb +30 -30
- data/spec/spec_helper.rb +3 -3
- data/spec/unit/rackspace_base_spec.rb +8 -8
- metadata +23 -78
- data/README.rdoc +0 -225
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "vcr"
|
3
|
+
require "ansi/code"
|
4
|
+
require "ansi/diff"
|
5
5
|
|
6
6
|
Chef::Config[:knife][:rackspace_api_username] = "#{ENV['OS_USERNAME']}"
|
7
7
|
Chef::Config[:knife][:rackspace_api_key] = "#{ENV['OS_PASSWORD']}"
|
@@ -9,28 +9,28 @@ Chef::Config[:knife][:ssl_verify_peer] = false
|
|
9
9
|
# Chef::Config[:knife][:rackspace_version] = "#{ENV['RS_VERSION']}"
|
10
10
|
|
11
11
|
VCR.configure do |c|
|
12
|
-
c.cassette_library_dir =
|
12
|
+
c.cassette_library_dir = "spec/cassettes"
|
13
13
|
c.hook_into :excon
|
14
14
|
c.configure_rspec_metadata!
|
15
15
|
|
16
16
|
# Sensitive data
|
17
|
-
c.filter_sensitive_data(
|
18
|
-
c.filter_sensitive_data(
|
19
|
-
c.filter_sensitive_data(
|
20
|
-
c.filter_sensitive_data(
|
17
|
+
c.filter_sensitive_data("_RAX_USERNAME_") { Chef::Config[:knife][:rackspace_api_username] }
|
18
|
+
c.filter_sensitive_data("_RAX_PASSWORD_") { Chef::Config[:knife][:rackspace_api_key] }
|
19
|
+
c.filter_sensitive_data("_CDN-TENANT-NAME_") { ENV["RS_CDN_TENANT_NAME"] }
|
20
|
+
c.filter_sensitive_data("000000") { ENV["RS_TENANT_ID"] }
|
21
21
|
|
22
22
|
c.before_record do |interaction|
|
23
23
|
# Sensitive data
|
24
|
-
filter_headers(interaction, /X-\w*-Token/,
|
24
|
+
filter_headers(interaction, /X-\w*-Token/, "_ONE-TIME-TOKEN_")
|
25
25
|
|
26
26
|
# Transient data (trying to avoid unnecessary cassette churn)
|
27
|
-
filter_headers(interaction,
|
28
|
-
filter_headers(interaction,
|
27
|
+
filter_headers(interaction, "X-Compute-Request-Id", "_COMPUTE-REQUEST-ID_")
|
28
|
+
filter_headers(interaction, "X-Varnish", "_VARNISH-REQUEST-ID_")
|
29
29
|
|
30
30
|
# Throw away build state - just makes server.wait_for loops really long during replay
|
31
31
|
begin
|
32
32
|
json = JSON.parse(interaction.response.body)
|
33
|
-
if json[
|
33
|
+
if json["server"]["status"] == "BUILD"
|
34
34
|
# Ignoring interaction because server is in BUILD state
|
35
35
|
interaction.ignore!
|
36
36
|
end
|
@@ -38,21 +38,21 @@ VCR.configure do |c|
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
c.before_playback do |
|
42
|
-
interaction.filter!(
|
41
|
+
c.before_playback do |interaction|
|
42
|
+
interaction.filter!("_TENANT-ID_", "0000000")
|
43
43
|
end
|
44
44
|
|
45
45
|
c.default_cassette_options = {
|
46
46
|
# :record => :none,
|
47
47
|
# Ignores cache busting parameters.
|
48
|
-
:match_requests_on => [:host, :path]
|
48
|
+
:match_requests_on => [:host, :path],
|
49
49
|
}
|
50
|
-
c.default_cassette_options.merge!({:record => :all}) if ENV[
|
50
|
+
c.default_cassette_options.merge!({ :record => :all }) if ENV["INTEGRATION_TESTS"] == "live"
|
51
51
|
end
|
52
52
|
|
53
53
|
def filter_headers(interaction, pattern, placeholder)
|
54
|
-
[interaction.request.headers, interaction.response.headers].each do |
|
55
|
-
sensitive_tokens = headers.select{|key| key.to_s.match(pattern)}
|
54
|
+
[interaction.request.headers, interaction.response.headers].each do |headers|
|
55
|
+
sensitive_tokens = headers.select { |key| key.to_s.match(pattern) }
|
56
56
|
sensitive_tokens.each do |key, value|
|
57
57
|
headers[key] = placeholder
|
58
58
|
end
|
@@ -67,8 +67,8 @@ end
|
|
67
67
|
|
68
68
|
def clean_output(output)
|
69
69
|
output = ANSI.unansi(output)
|
70
|
-
output.gsub!(/\s+$/,
|
71
|
-
output.gsub!("\e[0G",
|
70
|
+
output.gsub!(/\s+$/, "")
|
71
|
+
output.gsub!("\e[0G", "")
|
72
72
|
output
|
73
73
|
end
|
74
74
|
|
@@ -77,7 +77,7 @@ RSpec::Matchers.define :match_output do |expected_output|
|
|
77
77
|
clean_output(actual_output) == expected_output.strip
|
78
78
|
end
|
79
79
|
# Nice when it works, but has ANSI::Diff has some bugs that prevent it from showing any output
|
80
|
-
|
80
|
+
failure_message do |actual_output|
|
81
81
|
buffer = StringIO.new
|
82
82
|
buffer.puts clean_output(actual_output)
|
83
83
|
buffer.puts
|
@@ -87,18 +87,18 @@ RSpec::Matchers.define :match_output do |expected_output|
|
|
87
87
|
# ANSI::Diff.new(output, expected_output)
|
88
88
|
end
|
89
89
|
description do
|
90
|
-
|
90
|
+
"Compare actual and expected output, ignoring ansi color and trailing whitespace"
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
def server_list
|
95
|
-
stdout, stderr, status = knife_capture(
|
95
|
+
stdout, stderr, status = knife_capture("rackspace server list")
|
96
96
|
status == 0 ? stdout : stderr
|
97
97
|
end
|
98
98
|
|
99
99
|
def capture_instance_data(stdout, labels = {})
|
100
100
|
result = {}
|
101
|
-
labels.each do |
|
101
|
+
labels.each do |key, label|
|
102
102
|
result[key] = clean_output(stdout).match(/^#{label}: (.*)$/)[1]
|
103
103
|
end
|
104
104
|
result
|
@@ -106,8 +106,8 @@ end
|
|
106
106
|
|
107
107
|
# Ideally this belongs in knife-dsl, but it causes a scoping conflict with knife.rb.
|
108
108
|
# See https://github.com/chef-workflow/knife-dsl/issues/2
|
109
|
-
def knife_capture(command, args=[], input=nil)
|
110
|
-
null = Gem.win_platform? ? File.open(
|
109
|
+
def knife_capture(command, args = [], input = nil)
|
110
|
+
null = Gem.win_platform? ? File.open("NUL:", "r") : File.open("/dev/null", "r")
|
111
111
|
|
112
112
|
if defined? Pry
|
113
113
|
Pry.config.input = STDIN
|
@@ -118,9 +118,9 @@ def knife_capture(command, args=[], input=nil)
|
|
118
118
|
$VERBOSE = nil
|
119
119
|
old_stderr, old_stdout, old_stdin = $stderr, $stdout, $stdin
|
120
120
|
|
121
|
-
$stderr = StringIO.new(
|
122
|
-
$stdout = StringIO.new(
|
123
|
-
$stdin = input ? StringIO.new(input,
|
121
|
+
$stderr = StringIO.new("", "r+")
|
122
|
+
$stdout = StringIO.new("", "r+")
|
123
|
+
$stdin = input ? StringIO.new(input, "r") : null
|
124
124
|
$VERBOSE = warn
|
125
125
|
|
126
126
|
status = Chef::Knife::DSL::Support.run_knife(command, args)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
$:.unshift File.expand_path(
|
2
|
-
require
|
3
|
-
require
|
1
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "chef/knife/bootstrap"
|
3
|
+
require "chef/knife/rackspace_base"
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "chef/knife/rackspace_base"
|
4
|
+
require "chef/knife"
|
5
5
|
|
6
6
|
class RackspaceBaseTester < Chef::Knife
|
7
7
|
include Chef::Knife::RackspaceBase
|
@@ -15,7 +15,7 @@ describe "auth_endpoint" do
|
|
15
15
|
Chef::Config[:knife][:rackspace_auth_url] = test_url
|
16
16
|
Chef::Config[:knife][:rackspace_region] = :ord
|
17
17
|
|
18
|
-
tester.auth_endpoint.
|
18
|
+
expect(tester.auth_endpoint).to eq(test_url)
|
19
19
|
end
|
20
20
|
|
21
21
|
[:dfw, :ord, :syd].each do |region|
|
@@ -24,15 +24,15 @@ describe "auth_endpoint" do
|
|
24
24
|
Chef::Config[:knife][:rackspace_auth_url] = nil
|
25
25
|
Chef::Config[:knife][:rackspace_region] = region
|
26
26
|
|
27
|
-
tester.auth_endpoint.
|
27
|
+
expect(tester.auth_endpoint).to eq(::Fog::Rackspace::US_AUTH_ENDPOINT)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should pick the UK end point if the region is :lon" do
|
32
32
|
tester = RackspaceBaseTester.new
|
33
33
|
Chef::Config[:knife][:rackspace_auth_url] = nil
|
34
|
-
Chef::Config[:knife][:rackspace_region] =
|
34
|
+
Chef::Config[:knife][:rackspace_region] = "lon"
|
35
35
|
|
36
|
-
tester.auth_endpoint.
|
36
|
+
expect(tester.auth_endpoint).to eq(::Fog::Rackspace::UK_AUTH_ENDPOINT)
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
@@ -12,106 +12,50 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-
|
15
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: knife-windows
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name: fog
|
32
|
+
name: fog-rackspace
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '1
|
37
|
+
version: '0.1'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '1
|
44
|
+
version: '0.1'
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: chef
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
51
|
+
version: '12.0'
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: rspec
|
61
|
-
requirement: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
63
|
-
- - ! '>='
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '0'
|
66
|
-
type: :development
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - ! '>='
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '0'
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: vcr
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - ! '>='
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '0'
|
80
|
-
type: :development
|
81
|
-
prerelease: false
|
82
|
-
version_requirements: !ruby/object:Gem::Requirement
|
83
|
-
requirements:
|
84
|
-
- - ! '>='
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '0'
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
name: ansi
|
89
|
-
requirement: !ruby/object:Gem::Requirement
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
type: :development
|
95
|
-
prerelease: false
|
96
|
-
version_requirements: !ruby/object:Gem::Requirement
|
97
|
-
requirements:
|
98
|
-
- - ! '>='
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: '0'
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
|
-
name: rake
|
103
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
-
requirements:
|
105
|
-
- - ! '>='
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
version: '0'
|
108
|
-
type: :development
|
109
|
-
prerelease: false
|
110
|
-
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
requirements:
|
112
|
-
- - ! '>='
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: '0'
|
58
|
+
version: '12.0'
|
115
59
|
description: Rackspace Support for Chef's Knife Command
|
116
60
|
email:
|
117
61
|
- adam@chef.io
|
@@ -121,16 +65,17 @@ email:
|
|
121
65
|
executables: []
|
122
66
|
extensions: []
|
123
67
|
extra_rdoc_files:
|
124
|
-
- README.
|
68
|
+
- README.md
|
125
69
|
- LICENSE
|
126
70
|
files:
|
127
|
-
- .chef/knife.rb
|
128
|
-
- .
|
129
|
-
- .
|
71
|
+
- ".chef/knife.rb"
|
72
|
+
- ".github/ISSUE_TEMPLATE.md"
|
73
|
+
- ".gitignore"
|
74
|
+
- ".travis.yml"
|
130
75
|
- CHANGELOG.md
|
131
76
|
- Gemfile
|
132
77
|
- LICENSE
|
133
|
-
- README.
|
78
|
+
- README.md
|
134
79
|
- Rakefile
|
135
80
|
- knife-rackspace.gemspec
|
136
81
|
- lib/chef/knife/rackspace_base.rb
|
@@ -160,17 +105,17 @@ require_paths:
|
|
160
105
|
- lib
|
161
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
162
107
|
requirements:
|
163
|
-
- -
|
108
|
+
- - ">="
|
164
109
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
110
|
+
version: 2.2.2
|
166
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
112
|
requirements:
|
168
|
-
- -
|
113
|
+
- - ">="
|
169
114
|
- !ruby/object:Gem::Version
|
170
115
|
version: '0'
|
171
116
|
requirements: []
|
172
117
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.4.
|
118
|
+
rubygems_version: 2.4.8
|
174
119
|
signing_key:
|
175
120
|
specification_version: 4
|
176
121
|
summary: Rackspace Support for Chef's Knife Command
|
data/README.rdoc
DELETED
@@ -1,225 +0,0 @@
|
|
1
|
-
= Knife Rackspace
|
2
|
-
|
3
|
-
{<img src="https://travis-ci.org/chef/knife-rackspace.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/chef/knife-rackspace]
|
4
|
-
|
5
|
-
= DESCRIPTION:
|
6
|
-
|
7
|
-
This is the official Opscode Knife plugin for Rackspace Cloud Servers. This plugin gives knife the ability to create, bootstrap, and manage servers on all the regions for Rackspace Cloud Servers.
|
8
|
-
|
9
|
-
= INSTALLATION:
|
10
|
-
|
11
|
-
Be sure you are running the latest version Chef. Versions earlier than 0.10.0 don't support plugins:
|
12
|
-
|
13
|
-
gem install chef
|
14
|
-
|
15
|
-
This plugin is distributed as a Ruby Gem. To install it, run:
|
16
|
-
|
17
|
-
gem install knife-rackspace
|
18
|
-
|
19
|
-
Depending on your system's configuration, you may need to run this command with root privileges.
|
20
|
-
|
21
|
-
Ensure only the latest knife-rackspace gem and no other is installed. In some cases having older versions of the gem
|
22
|
-
will cause the new OpenStack functionality not to function properly. To check:
|
23
|
-
|
24
|
-
$> gem list --local | grep knife-rackspace
|
25
|
-
knife-rackspace (0.6.2, 0.5.12)
|
26
|
-
$> gem uninstall knife-rackspace -v "= 0.5.12"
|
27
|
-
Successfully uninstalled knife-rackspace-0.5.12
|
28
|
-
$> gem list --local | grep knife-rackspace
|
29
|
-
knife-rackspace (0.6.2)
|
30
|
-
|
31
|
-
|
32
|
-
= CONFIGURATION:
|
33
|
-
|
34
|
-
In order to communicate with the Rackspace Cloud API you will have to tell Knife about your Username and API Key. The easiest way to accomplish this is to create some entries in your <tt>knife.rb</tt> file:
|
35
|
-
|
36
|
-
knife[:rackspace_api_username] = "Your Rackspace API username"
|
37
|
-
knife[:rackspace_api_key] = "Your Rackspace API Key"
|
38
|
-
|
39
|
-
If your knife.rb file will be checked into a SCM system (ie readable by others) you may want to read the values from environment variables:
|
40
|
-
|
41
|
-
knife[:rackspace_api_username] = "#{ENV['RACKSPACE_USERNAME']}"
|
42
|
-
knife[:rackspace_api_key] = "#{ENV['RACKSPACE_API_KEY']}"
|
43
|
-
|
44
|
-
You also have the option of passing your Rackspace API Username/Key into the individual knife subcommands using the <tt>-A</tt> (or <tt>--rackspace-api-username</tt>) <tt>-K</tt> (or <tt>--rackspace-api-key</tt>) command options
|
45
|
-
|
46
|
-
# provision a new 1GB Ubuntu 10.04 webserver
|
47
|
-
knife rackspace server create -I 112 -f 3 -A 'Your Rackspace API username' -K "Your Rackspace API Key" -r 'role[webserver]'
|
48
|
-
|
49
|
-
To select for the previous Rackspace API (aka 'v1'), you can use the <tt>--rackspace-version v1</tt> command option. 'v2' is the default, so if you're still using exclusively 'v1' you will probably want to add the following to your <tt>knife.rb</tt>:
|
50
|
-
|
51
|
-
knife[:rackspace_version] = 'v1'
|
52
|
-
|
53
|
-
This plugin also has support for authenticating against an alternate API Auth URL. This is useful if you are a using a custom endpoint, here is an example of configuring your <tt>knife.rb</tt>:
|
54
|
-
|
55
|
-
knife[:rackspace_auth_url] = "auth.my-custom-endpoint.com"
|
56
|
-
|
57
|
-
|
58
|
-
Different regions can be specified by using the `--rackspace-region` switch or using the `knife[:rackspace_region]` in the knife.rb file. Valid regions include :dfw, :ord, :lon, and :syd.
|
59
|
-
|
60
|
-
If you are behind a proxy you can specify it in the knife.rb file as follows:
|
61
|
-
|
62
|
-
https_proxy https://PROXY_IP_ADDRESS:PORT
|
63
|
-
|
64
|
-
SSL certificate verification can be disabled by include the following in your knife.rb file:
|
65
|
-
|
66
|
-
knife[:ssl_verify_peer] = false
|
67
|
-
|
68
|
-
Additionally the following options may be set in your <tt>knife.rb</tt>:
|
69
|
-
|
70
|
-
* flavor
|
71
|
-
* image
|
72
|
-
* distro
|
73
|
-
* template_file
|
74
|
-
|
75
|
-
= SUBCOMMANDS:
|
76
|
-
|
77
|
-
This plugin provides the following Knife subcommands. Specific command options can be found by invoking the subcommand with a <tt>--help</tt> flag
|
78
|
-
|
79
|
-
== knife rackspace server create
|
80
|
-
|
81
|
-
Provisions a new server in the Rackspace Cloud and then perform a Chef bootstrap (using the SSH protocol). The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists (provided by the provisioning). It is primarily intended for Chef Client systems that talk to a Chef server. By default the server is bootstrapped using the {chef-full}[https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/chef-full.erb] template. This can be overridden using the <tt>-d</tt> or <tt>--template-file</tt> command options.
|
82
|
-
|
83
|
-
If no name is provided, nodes created with the v1 API are named after their instance ID, with the v2 API they are given a random 'rs-XXXXXXXXX' name.
|
84
|
-
|
85
|
-
Files can be injected onto the provisioned system using the <tt>--file</tt> switch. For example to inject <tt>my_script.sh</tt> into <tt>/root/initialize.sh</tt> you would use the following switch
|
86
|
-
|
87
|
-
--file /root/initialize.sh=my_script.sh.
|
88
|
-
|
89
|
-
Note: You can only inject text files and the maximum destination path is 255 characters.
|
90
|
-
|
91
|
-
You may specify if want to manage your disk partitioning scheme with the <tt>--rackspace-disk-config DISKCONFIG</tt> option. If you bootstrap a `v2` node and leave this set to the default "AUTO", larger nodes take longer to bootstrap as it grows the disk from 10G to fill the full amount of local disk provided. This option allows you to pass "MANUAL" - which give you a node (in 1/2 to 1/4 of the time) and lets you manage ignoring, or formatting the rest of the disk on your own.
|
92
|
-
|
93
|
-
http://docs.openstack.org/essex/openstack-compute/starter/content/Launch_and_manage_instances-d1e1885.html
|
94
|
-
|
95
|
-
You may specify a custom network using the <tt>--network [LABEL_OR_ID]</tt> option. You can also remove the default internal ServiceNet and PublicNet networks by specifying the <tt>--no-default-networks</tt> switch. To use a network other than PublicNet for the bootstrap connection, specify the <tt>--bootstrap-network LABEL</tt> option.
|
96
|
-
|
97
|
-
Note: If you are using one of the `performanceX-X` machines, you need to put `-f` or `--flavor` in quotes.
|
98
|
-
|
99
|
-
=== Windows
|
100
|
-
|
101
|
-
Windows Servers require special treatment with the knife-rackspace gem.
|
102
|
-
|
103
|
-
First, you'll need to ensure you've installed the knife-windows gem. Installation instructions can be found over here: http://docs.opscode.com/plugin_knife_windows.html#install-this-plugin
|
104
|
-
|
105
|
-
Secondly, you need to make sure that the image you're using has WinRM pre-configured. Unfortuantely, none of the Rackspace Windows image have this done by default, so you'll need to run the following instructions in a Windows machine, then save a Snapshot to use when creating servers with knife rackspace: http://docs.opscode.com/plugin_knife_windows.html#requirements
|
106
|
-
|
107
|
-
Thirdly, you must pass two extra parameters to the knife rackspace create command:
|
108
|
-
|
109
|
-
--bootstrap-protocol winrm --distro windows-chef-client-msi
|
110
|
-
|
111
|
-
If you have troubles, make sure you add the <tt>-VV</tt> switch for extra verbosity. The <tt>--server-create-timeout </tt> switch may also be your friend, as Windows machines take a long time to build compared to Linux ones.
|
112
|
-
|
113
|
-
== knife rackspace server delete
|
114
|
-
|
115
|
-
Deletes an existing server in the currently configured Rackspace Cloud account by the server/instance id. You can find the instance id by entering <tt>knife rackspace server list</tt>. Please note - this does not delete the associated node and client objects from the Chef server unless you pass the <tt>-P</tt> or <tt>--purge</tt> command option. Using the <tt>--purge</tt> option with v2 nodes will attempt to delete the node and client by the name of the node.
|
116
|
-
|
117
|
-
== knife rackspace server list
|
118
|
-
|
119
|
-
Outputs a list of all servers in the currently configured Rackspace Cloud account. Please note - this shows all instances associated with the account, some of which may not be currently managed by the Chef server. You may need to use the <tt>--rackspace-version</tt> and <tt>--rackspace-region</tt> options to see nodes in different Rackspace regions.
|
120
|
-
|
121
|
-
== knife rackspace flavor list
|
122
|
-
|
123
|
-
Outputs a list of all available flavors (available hardware configuration for a server) available to the currently configured Rackspace Cloud account. Each flavor has a unique combination of disk space, memory capacity and priority for CPU time. This data can be useful when choosing a flavor id to pass to the <tt>knife rackspace server create</tt> subcommand. You may need to use the <tt>--rackspace-version</tt> and <tt>--rackspace-region</tt> options to see nodes in different Rackspace regions.
|
124
|
-
|
125
|
-
== knife rackspace image list
|
126
|
-
|
127
|
-
Outputs a list of all available images available to the currently configured Rackspace Cloud account. An image is a collection of files used to create or rebuild a server. Rackspace provides a number of pre-built OS images by default. This data can be useful when choosing an image id to pass to the <tt>knife rackspace server create</tt> subcommand. You may need to use the <tt>--rackspace-version</tt> and <tt>--rackspace-region</tt> options to see nodes in different Rackspace regions.
|
128
|
-
|
129
|
-
== knife rackspace network list
|
130
|
-
|
131
|
-
Outputs a list of available networks to the currently configured Rackspace Cloud account. Networks can be added at a server during the creation process using the <tt>--network [LABEL_OR_ID]</tt> option. Knife does not currently support adding a network to an existing server.
|
132
|
-
|
133
|
-
== knife rackspace network create
|
134
|
-
|
135
|
-
Creates a new cloud network. Both the label and the CIDR are required parameters which are specified using the <tt>--label LABEL</tt> and <tt>--cidr CIDR</tt> respectively. The CIDR should be in the form of 172.16.0.0/24 or 2001:DB8::/64. Refer to http://www.rackspace.com/knowledge_center/article/using-cidr-notation-in-cloud-networks for more information.
|
136
|
-
|
137
|
-
== knife rackspace network delete
|
138
|
-
|
139
|
-
Deletes one or more specified networks by id. The network must be detached from all hosts before it is deleted.
|
140
|
-
|
141
|
-
|
142
|
-
== Knife & Rackspace Rackconnect
|
143
|
-
|
144
|
-
Rackspace Rackconnect allows the creation of a hybrid setup where you can have Cloud servers which are connected to bare metal hardware like Firewalls and Load balancers. You can read more about this product at http://www.rackspace.com/cloud/hybrid/rackconnect/
|
145
|
-
|
146
|
-
Under the hood, this changes the behaviour of how the cloud servers are configured and how IP addresses are assigned to them. So when using knife-rackspace with a 'Rack connected' cloud account you need use some additional parameters. See the sections below for more information regarding the two versions of Rack Connect.
|
147
|
-
|
148
|
-
Note: If you account is leveraging private cloud networks for Rackconnnect then you are using Rackconnect v3. You can also find your version of Rackconnect by checking with your support team
|
149
|
-
|
150
|
-
|
151
|
-
=== Knife and Rackconnect version 2
|
152
|
-
|
153
|
-
knife rackspace server create \
|
154
|
-
--server-name <name of the server> \
|
155
|
-
--image <Rackspace image id> \
|
156
|
-
--flavor <Rackspace flavor id> \
|
157
|
-
-r 'role[base]' \
|
158
|
-
--rackconnect-wait
|
159
|
-
|
160
|
-
Note: If the server is also part of Rackspace Managed Operations service level you will need to add the <tt>--rackspace-servicelevel-wait</tt> option.
|
161
|
-
|
162
|
-
knife rackspace server create \
|
163
|
-
--server-name <name of the server> \
|
164
|
-
--image <Rackspace image id> \
|
165
|
-
--flavor <Rackspace flavor id> \
|
166
|
-
-r 'role[base]' \
|
167
|
-
--rackconnect-wait \
|
168
|
-
--rackspace-servicelevel-wait
|
169
|
-
|
170
|
-
<tt>--rackconnect-wait</tt> does the following :-
|
171
|
-
|
172
|
-
* Rackconnect version 2 changes the networking on the cloud server and forces all trafic to route via the dedicated firewall or load balancer. It also then assigns the cloud server a new public IP address. The status of this automation provided by updates to the cloud server metadata. This option makes Knife wait for the Rackconnect automation to complete by checking the metadata.
|
173
|
-
|
174
|
-
* Once the status is updated, it triggers the bootstrap process.
|
175
|
-
|
176
|
-
|
177
|
-
<tt>--rackspace-servicelevel-wait</tt> does the following :-
|
178
|
-
|
179
|
-
* For Cloud servers in the Managed operations service level, Rackspace installs additional agents and software which enables them to provide support. This automation. like the Rackconnect one, updates the cloud server metadata of its status. Likewise, using this option, makes knife wait till the automation is complete before triggering the bootstrap process.
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
=== Knife and Rackconnect version 3
|
184
|
-
|
185
|
-
In case of version 3, there is a different command line option.
|
186
|
-
|
187
|
-
knife rackspace server create \
|
188
|
-
--server-name <name of the server> \
|
189
|
-
--image <Rackspace image id> \
|
190
|
-
--flavor <Rackspace flavor id> \
|
191
|
-
-r 'role[base]' \
|
192
|
-
--rackconnect-v3-network-id <cloud network id>
|
193
|
-
|
194
|
-
|
195
|
-
<tt>--rackconnect-v3-network-id</tt> does the following :-
|
196
|
-
* Create the server with the corresponding cloud network. The network id the id of an existing cloud network.
|
197
|
-
* Knife will then issue addtional API calls to the Rackconnect API to assign a new public IP to the cloud server. The new IP is also stored in the Cloud Server Metadata under accessv4IP.
|
198
|
-
* Knife then waits for the IP to be provisioned before triggering the bootstrap process.
|
199
|
-
|
200
|
-
Functionally, this operates the same way as version 2. However, behind the scenes, Rackconnect v3 is signifcantly different in implementation. You can learn about the differences here :
|
201
|
-
http://www.rackspace.com/knowledge_center/article/comparing-rackconnect-v30-and-rackconnect-v20
|
202
|
-
|
203
|
-
|
204
|
-
= LICENSE:
|
205
|
-
|
206
|
-
Author:: Adam Jacob (<adam@chef.io>)
|
207
|
-
Author:: Seth Chisamore (<schisamo@chef.io>)
|
208
|
-
Author:: Matt Ray (<matt@chef.io>)
|
209
|
-
Author:: JJ Asghar (<jj@chef.io>)
|
210
|
-
Author:: Rackspace Developers
|
211
|
-
Copyright:: Copyright (c) 2009-2012 Opscode, Inc.
|
212
|
-
Copyright:: Copyright (c) 2013-2015 Chef Software, Inc.
|
213
|
-
License:: Apache License, Version 2.0
|
214
|
-
|
215
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
216
|
-
you may not use this file except in compliance with the License.
|
217
|
-
You may obtain a copy of the License at
|
218
|
-
|
219
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
220
|
-
|
221
|
-
Unless required by applicable law or agreed to in writing, software
|
222
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
223
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
224
|
-
See the License for the specific language governing permissions and
|
225
|
-
limitations under the License.
|