Chef

Table Of Contents

knife linode

Linode is a cloud hosting platform that provides virtual private server hosting from the kernal and root access on up. The knife linode subcommand is used to manage API-driven cloud servers that are hosted by Linode.

Note

Review the list of common options available to this (and all) knife subcommands and plugins.

Install this plugin

To install the knife linode plugin using RubyGems, run the following command:

$ /opt/chef/embedded/bin/gem install knife-linode

where /opt/chef/embedded/bin/ is the path to the location where the chef-client expects knife plugins to be located. If the chef-client was installed using RubyGems, omit the path in the previous example.

datacenter list

The datacenter list argument is used to view a list of available data centers, listed by data center ID and location.

Syntax

This argument has the following syntax:

$ knife linode datacenter list

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

flavor list

The flavor list argument is used to get a list of servers from the Linode environment, listed by ID, name, RAM, disk, and price.

Syntax

This argument has the following syntax:

$ knife linode flavor list

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

image list

The image list argument is used to list of images from the Linode environment, listed by ID, name, bits, and image size.

Syntax

This argument has the following syntax:

$ knife linode image list

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

kernel list

The kernel list argument is used to view a list of available kernels, listed by ID and name.

Syntax

This argument has the following syntax:

$ knife linode kernel list

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

server create

The server create argument is used to create a new Linode cloud instance. This will provision a new image in Linode, perform a bootstrap (using the SSH protocol), and then install the chef-client on the target system so that it can be used to configure the node and to communicate with a Chef server.

Syntax

This argument has the following syntax:

$ knife linode server create (options)

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.
--bootstrap-version VERSION
The version of the chef-client to install.
-d DISTRO, --distro DISTRO
The template file to be used during a bootstrap operation. The following distributions are supported: chef-full (the default bootstrap), centos5-gems, fedora13-gems, ubuntu10.04-gems, ubuntu10.04-apt, ubuntu12.04-gems, and the name of a custom bootstrap template file. When this option is used, knife will search for the template file in the following order: the bootstrap/ folder in the current working directory, the bootstrap/ folder in the chef-repo, the bootstrap/ folder in the ~/.chef/ directory, or a default bootstrap file. Do not use the --template-file option when --distro is specified.
-D DATACENTER, --linode-datacenter DATACENTER
The datacenter for the Linode server.
-f FLAVOR, --linode-flavor FLAVOR
The flavor of the Linode server.
--hint HINT_NAME[=HINT_FILE]

Use to specify an Ohai hint to be set on the target node.

Ohai hints are used to tell Ohai something about the system that it is running on that it would not be able to discover itself. An Ohai hint exists if a JSON file exists in the hint directory with the same name as the hint. For example, calling hint?('antartica') in an Ohai plugin would return an empty hash if the file antartica.json existed in the hints directory, and return nil if the file does not exist.

If the hint file contains JSON content, it will be returned as a hash from the call to hint?.

{
  "snow": true,
  "penguins": "many"
}
arctic_hint = hint?('antartica')
if arctic_hint['snow']
  "There are #{arctic_hint['penguins']} penguins here."
else
  "There is no snow here, and penguins like snow."
end

The default directory in which hint files are located is /etc/chef/ohai/hints/. Use the Ohai::Config[:hints_path] setting in the client.rb file to customize this location.

HINT_FILE is the name of the JSON file. HINT_NAME is the name of a hint in a JSON file. Use multiple --hint options to specify multiple hints.

-i IDENTITY_FILE, --identity-file IDENTITY_FILE
The SSH identity file used for authentication. Key-based authentication is recommended.
-I IMAGE, --linode-image IMAGE
The image for the Linode server.
-j JSON_ATTRIBS, --json-attributes JSON_ATTRIBS
A JSON string that is added to the first run of a chef-client.
-k KERNEL, --linode-kernel KERNEL
The kernel for the Linode server.
-L NAME, --linode-node-name NAME
The name of the node in the Linode environment.
-N NAME, --node-name NAME
The name of the node.
--[no-]host-key-verify
Use --no-host-key-verify to disable host key verification. Default setting: --host-key-verify.
-P PASSWORD, --ssh-password PASSWORD
The SSH password. This can be used to pass the password directly on the command line. If this option is not specified (and a password is required) knife will prompt for the password.
--prerelease
Use to install pre-release gems.
-r RUN_LIST, --run-list RUN_LIST
A comma-separated list of roles and/or recipes to be applied.
--template-file TEMPLATE
The path to a template file that will be used during a bootstrap operation. Do not use the --distro option when --template-file is specified.
-x USER_NAME, --ssh-user USER_NAME
The SSH user name.

server delete

The server delete argument is used to delete one or more instances that are running in the Linode cloud. To find a specific cloud instance, use the knife linode server list argument. Use the knife node delete and knife client delete sub-commands to delete associated node and client objects (if required).

Syntax

This argument has the following syntax:

$ knife linode server delete LINODE_ID

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

server list

The server list argument is used to find instances that are associated with a Linode account. The results may show instances that are not currently managed by the Chef server.

Syntax

This argument has the following syntax:

$ knife linode server list

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

server reboot

The server reboot argument is used to reboot all of the servers in a Linode environment.

Syntax

This argument has the following syntax:

$ knife linode server reboot LINODE_ID

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.

stackscript list

Linode StackScripts are customized distribution templates. This argument is used to view a list of Linode StackScripts that are currently being used.

Syntax

This argument has the following syntax:

$ knife linode stackscript list

Options

This argument has the following options:

-A KEY, --linode-api-key KEY
The Linode API key.