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.
Be sure you are running the latest version Chef. Versions earlier than 0.10.0 don’t support plugins:
gem install chef
This plugin is distributed as a Ruby Gem. To install it, run:
gem install knife-rackspace
Depending on your system’s configuration, you may need to run this command with root privileges.
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 knife.rb
file:
knife[:rackspace_api_username] = "Your Rackspace API username" knife[:rackspace_api_key] = "Your Rackspace API Key"
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:
knife[:rackspace_api_username] = "#{ENV['RACKSPACE_USERNAME']}" knife[:rackspace_api_key] = "#{ENV['RACKSPACE_API_KEY']}"
You also have the option of passing your Rackspace API Username/Key into the individual knife subcommands using the -A
(or --rackspace-api-username
) -K
(or --rackspace-api-key
) command options
# provision a new 1GB Ubuntu 10.04 webserver knife rackspace server create -I 112 -f 3 -A 'Your Rackspace API username' -K "Your Rackspace API Key" -r 'role[webserver]'
To select for the previous Rackspace API (aka ‘v1’), you can use the --rackspace-version v1
command option. ‘v2’ is the default, so if you’re still using exclusively ‘v1’ you will probably want to add the following to your knife.rb
:
knife[:rackspace_version] = 'v1'
This plugin also has support for authenticating against an alternate API Auth URL. This is useful if you are a Rackspace Cloud UK user, here is an example of configuring your knife.rb
:
knife[:rackspace_auth_url] = "lon.auth.api.rackspacecloud.com"
This plugin also has support for specifying which region to create servers into:
knife[:rackspace_endpoint] = "https://dfw.servers.api.rackspacecloud.com/v2"
valid options include:
DFW_ENDPOINT = 'https://dfw.servers.api.rackspacecloud.com/v2' ORD_ENDPOINT = 'https://ord.servers.api.rackspacecloud.com/v2' LON_ENDPOINT = 'https://lon.servers.api.rackspacecloud.com/v2'
If you are behind a proxy you can specify it in the knife.rb file as follows:
https_proxy PROXY_IP_ADDRESS:PORT
SSL certificate verification can be disabled by include the following in your knife.rb file:
knife = false
Additionally the following options may be set in your ‘knife.rb`:
-
flavor
-
image
-
distro
-
template_file
This plugin provides the following Knife subcommands. Specific command options can be found by invoking the subcommand with a --help
flag
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 template. This can be overridden using the -d
or --template-file
command options.
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.
Files can be injected onto the provisioned system using the --file
switch. For example to inject my_script.sh
into /root/initialize.sh
you would use the following switch
--file /root/initialize.sh=my_script.sh.
Note: You can only inject text files and the maximum destination path is 255 characters.
Deletes an existing server in the currently configured Rackspace Cloud account by the server/instance id. You can find the instance id by entering ‘knife rackspace server list’. Please note - this does not delete the associated node and client objects from the Chef server unless you pass the -P
or --purge
command option. Using the --purge
option with v2 nodes will attempt to delete the node and client by the name of the node.
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 --rackspace-version
and possibly a --rackspace-endpoint
options to see nodes in different Rackspace regions.
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 knife rackspace server create
subcommand. You may need to use the --rackspace-version
and possibly a --rackspace-endpoint
options to see nodes in different Rackspace regions.
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 knife rackspace server create
subcommand. You may need to use the --rackspace-version
and possibly a --rackspace-endpoint
options to see nodes in different Rackspace regions.
- Author
-
Adam Jacob (<[email protected]>)
- Author
-
Seth Chisamore (<[email protected]>)
- Author
-
Matt Ray (<[email protected]>)
- Copyright
-
Copyright © 2009-2012 Opscode, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.