Knife Gandi

DESCRIPTION:

This plugin gives knife the ability to create, bootstrap, and manage servers on the Gandi Hosting platform.

INSTALLATION:

This plugin is distributed as a Ruby Gem. To install it, run:

gem install knife-gandi

Depending on your system’s configuration, you may need to run this command with root privileges.

CONFIGURATION:

In order to communicate with the Gandi Hosting API you will have to tell Knife about your API Key. The easiest way to accomplish this is to create some entries in your knife.rb file:

knife[:gandi_api_key]  = "Your Gandi 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[:gandi_api_key] = "#{ENV['GANDI_API_KEY']}"

You also have the option of passing your Gandi API Key into the individual knife subcommands using -K (or --gandi-api-key) command option

# provision a new 1GB Ubuntu 10.04 webserver
knife gandi server create 'role[webserver]' -I 23 -M 1024 -K "Your Gandi API Key"

Additionally the following options may be set in your ‘knife.rb`:

  • template_file

SUBCOMMANDS:

This plugin provides the following Knife subcommands. Specific command options can be found by invoking the subcommand with a --help flag

knife gandi server create

Provisions a new server in the Gandi Hosting platform 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 ubuntu10.04-gems template. This can be overridden using the -d or --template-file command options.

Gandi server images have the root account enabled by default. When a server instance is created, a user with the credentials you provide is created. This account does not have sudo enabled, therefore the root account will alway be used to bootstrap Chef. For security reasons, it is recommended that you enable sudo for some user account then disable the root account once the create command returns.

Make sure your Gandi account has sufficient resources in order to create a server.

The Gandi Hosting platform will always try to recycle any IP address previously released from a server created using your Gandi account. Note that if you do not remove that IP address’ fingerprint from ~/.ssh/known_hosts, you will get a ‘could not connect’/Net::SSH::HostKeyMismatch Warning during the bootstrap phase and the bootstrap phase will be skipped. You can disable the host key check in your ssh settings, know the security implications before doing that.

knife gandi server delete

Deletes an existing server in the currently configured Gandi account. Please note - this does not delete the associated node and client objects from the Chef server.

knife gandi server list

Outputs a list of all servers in the currently configured Gandi account. Please note - this shows all instances associated with the account, some of which may not be currently managed by the Chef server.

knife gandi datacenter list

Outputs a list of all available datacenters. This data can be useful when choosing a datacenter id to pass to the knife gandi server create subcommand.

knife gandi image list

Outputs a list of all available images available to the currently configured Gandi account. An image is a collection of files used to create or rebuild a server. Gandi 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 gandi server create subcommand.

LICENSE:

Author

Maxime Liron (<[email protected]>)

Copyright

Copyright © 2009-2011 Maxime Liron

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.