knife-bootstrap
- Install Chef Client on a remote host
knife bootstrap (options)
-i
, --identity-file IDENTITY_FILE
-N
, --node-name NAME
-P
, --ssh-password PASSWORD
-x
, --ssh-user USERNAME
-p
, --ssh-port PORT
--bootstrap-version VERSION
--bootstrap-proxy PROXY_URL
The proxy server for the node being bootstrapped
--prerelease
-r
, --run-list RUN_LIST
--template-file TEMPLATE
--sudo
-d
, --distro DISTRO
--no-host-key-verify
Performs a Chef Bootstrap on the target node. 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. This sub-command is used internally by some cloud computing plugins.
The bootstrap sub-command supports supplying a template to perform the
bootstrap steps. If the distro is not specified (via -d
or --distro
option), an Ubuntu 10.04 host bootstrapped with RubyGems is assumed. The
DISTRO value corresponds to the base filename of the template, in
other words DISTRO
.erb. A template file can be specified with the
--template-file
option in which case the DISTRO is not used. The
sub-command looks in the following locations for the template to use:
bootstrap
directory in the installed Chef Knife library.bootstrap
directory in the $PWD/.chef
.bootstrap
directory in the users $HOME/.chef
.The default bootstrap templates are scripts that get copied to the target node (FQDN). The following distros are supported:
The gems installations will use RubyGems 1.3.6 and Chef installed as a gem. The apt installation will use the Opscode APT repository. The RubyGems installation requires installing gems with native extensions, so development related packages (ruby-dev, build-essential) are installed. These are not installed with the apt installation, as native extensions are already compiled in the required packages.
In addition to handling the software installation, these bootstrap templates do the following:
/etc/chef/client.rb
) using values from the knife.rb
.In the case of the RubyGems, the client.rb
will be written from
scratch with a minimal set of values; see EXAMPLES. In the case of
APT Package installation, client.rb
will have the
validation_client_name
appended if it is not set to chef-validator
(default config value), and the node_name
will be added if
chef_node_name
option is specified.
When this is complete, the bootstrapped node will have:
Additional custom bootstrap templates can be created and stored in
.chef/bootstrap/DISTRO.erb
, replacing DISTRO with the value passed
with the -d
or --distro
option. See EXAMPLES for more
information.
Setting up a custom bootstrap is fairly straightforward. Create a
.chef/bootstrap
directory in your Chef Repository or in
$HOME/.chef/bootstrap
. Then create the ERB template file.
mkdir ~/.chef/bootstrap
vi ~/.chef/bootstrap/debian5.0-apt.erb
For example, to create a new bootstrap template that should be used when setting up a new Debian node. Edit the template to run the commands, set up the validation certificate and the client configuration file, and finally to run chef-client on completion. The bootstrap template can be called with:
knife bootstrap mynode.example.com --template-file ~/.chef/bootstrap/debian5.0-apt.erb
Or,
knife bootstrap mynode.example.com --distro debian5.0-apt
The --distro
parameter will automatically look in the
~/.chef/bootstrap
directory for a file named debian5.0-apt.erb
.
Templates provided by the Chef installation are located in
BASEDIR/lib/chef/knife/bootstrap/*.erb
, where BASEDIR is the
location where the package or Gem installed the Chef client libraries.
knife bootstrap
is not capable of bootstrapping multiple hosts in
parallel.
The bootstrap script is passed as an argument to sh(1) on the remote system, so sensitive information contained in the script will be visible to other users via the process list using tools such as ps(1).
knife-ssh(1)
Chef was written by Adam Jacob adam@opscode.com with many contributions from the community.
This manual page was written by Joshua Timberman joshua@opscode.com. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.
Knife is distributed with Chef. http://wiki.opscode.com/display/chef/Home