Skip to content

Latest commit

 

History

History
138 lines (78 loc) · 8.51 KB

README.rdoc

File metadata and controls

138 lines (78 loc) · 8.51 KB

<img src=“https://badge.fury.io/rb/knife-cloudstack-fog.png” alt=“Gem Version” /> <img src=“https://travis-ci.org/fifthecho/knife-cloudstack-fog.png?branch=master” alt=“Build Status” /> <img src=“https://gemnasium.com/fifthecho/knife-cloudstack-fog.png” alt=“Dependency Status” />

Knife Cloudstack

DESCRIPTION:

This is the unofficial Opscode Knife plugin for Apache CloudStack / Citrix CloudPlatform Clouds. This plugin gives knife the ability to create, bootstrap, and manage instances in Cloudstack Compute clouds.

INSTALLATION:

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-cloudstack-fog

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

Also, all of these commands have been tested against CloudStack/CloudPlatform 2.2.14 and 3.0.6.

CONFIGURATION:

In order to communicate with an Cloudstack Compute cloud’s CLOUDSTACK API you will have to tell Knife about your Cloudstack Compute cloud API endpoint, Cloudstack Access Key and Secret Access Key. The easiest way to accomplish this is to create some entries in your knife.rb file:

### Note: You may need to append the :cloudstack_access_key_id with ":$PROJECT_NAME", if it differs from your Cloudstack Username.
knife[:cloudstack_access_key_id]     = "Your Cloudstack Access Key ID"
knife[:cloudstack_secret_access_key] = "Your Cloudstack Secret Access Key"
### Note: If you are not proxying HTTPS to the Cloudstack CLOUDSTACK API port, the scheme should be HTTP, and the PORT is 8773.
knife[:cloudstack_api_endpoint]      = "https://cloud.mycompany.com/service/Cloud"

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[:cloudstack_access_key_id]     = "#{ENV['CLOUDSTACK_ACCESS_KEY']}"
knife[:cloudstack_secret_access_key] = "#{ENV['CLOUDSTACK_SECRET_KEY']}"
knife[:cloudstack_api_endpoint]      = "#{ENV['CLOUDSTACK_URL']}"

You also have the option of passing your Cloudstack API Key/Secret into the individual knife subcommands using the -A (or --cloudstack-access-key-id) -K (or --cloudstack-secret-access-key) command options

# provision a new webserver
knife cloudstack server create 'role[webserver]' -I <image template> -f <service offering> -A 'Your Cloudstack Access Key ID'  --cloudstack-api-endpoint 'https://cloud.mycompany.com/v1.0'

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

  • flavor

  • image

  • availability_zone

SUBCOMMANDS:

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

knife cloudstack server create

Provisions a new server in an Cloudstack Compute 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.

knife cloudstack server delete

Deletes an existing server in the currently configured Cloudstack Compute cloud account. PLEASE NOTE - this does not delete the associated node and client objects from the Chef server.

knife cloudstack server list

Outputs a list of all servers in the currently configured Cloudstack Compute cloud account. PLEASE NOTE - this shows all instances associated with the account, some of which may not be currently managed by the Chef server.

knife cloudstack serviceoffering list

Outputs a list of all available service offerings (available hardware configuration for a server) available to the currently configured Cloudstack Compute cloud account. Each service offering has a unique combination of disk space, memory capacity and priority for CPU time. This data can be useful when choosing a service offering ID to pass to the knife cloudstack server create subcommand.

knife cloudstack template list

Outputs a list of all available templates available to the currently configured Cloudstack Compute cloud account. A template is a collection of files used to create or rebuild a server. This data can be useful when choosing an template ID to pass to the knife cloudstack server create subcommand.

knife cloudstack keypair create

Create a new SSH keypair or register a public key to the currently configured Cloudstack Compute cloud account. This command is valuable to provide password recovery options as well as associating a Cloudstack keypair with an instance for any advanced authentication methods when instantiating a server with the knife cloudstack server create subcommand.

knife cloudstack keypair delete

Delete a keypair which is abailable to the currently configured Cloudstack Compute cloud account.

knife cloudstack keypair list

Outputs a list of all available keypairs available to the currently configured Cloudstack Compute cloud account. This information is valuable to provide password recovery options as well as associating a Cloudstack keypair with an instance for any advanced authentication methods when instantiating a server with the knife cloudstack server create subcommand.

knife cloudstack network list

Outputs a list of all available network offerings available to the currently configured Cloudstack Compute cloud account. This information is necessary to locate a network ID when instantiating a server with the knife cloudstack server create subcommand if your Cloudstack Compute cloud requires a server be associated with a particular network offering.

knife cloudstack portforwardingrule list

Outputs a list of all port forwarding rules.

knife cloudstack publicip create

Assign a new public ip address to the zone specified by -z option. This sub command is available only on advanced network (VLAN enabled) zone.

knife cloudstack publicip list

Outputs a list of all public ip addresses assigned to the account. This sub command is available only on advanced network (VLAN enabled) zone.

knife cloudstack securitygroup list

Outputs a list of all available security groups defined for the currently configured Cloudstack Compute cloud account. This information is necessary to locate a security group ID when instantiating a server with the knife cloudstack server create subcommand if your Cloudstack Compute cloud requires a server be associated with a security group.

knife cloudstack zone list

Outputs a list of all available zones available to the currently configured Cloudstack Compute cloud account. This information is necessary to locate a zone ID when instantiating a server with the knife cloudstack server create subcommand.

knife cloudstack diskofferings list

Outputs a list of all available disk offerings available to the currently configured Cloudstack Compute cloud account. This information is valuable if you are also seeking to provision a data disk alongside your root volume when instantiating a server with the knife cloudstack server create subcommand.

knife cloudstack network create

Creates networks to be used by the knife cloudstack server create command in zones that are configured in Advanced/VPC networking modes.

LICENSE:

Author

Chirag Jog (<[email protected]>), Jeff Moody (<[email protected]>), Damien Fuentes, Takashi Kanai (<[email protected]>)

Copyright

Copyright © 2011 Clogeny, 2012 Datapipe, 2012 IDC Frontier 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.