chef-metal-null
This is a driver for chef-metal that
doesn't actually create or destroy any machines. What it does allow you to do
however is make use of the bootstrap and converge features of Chef Metal on
machines that are already created.
You can also mix and match cloud created and manually created machines while
still using chef-metal to bootstrap them.
Installation
Just install the gem:
$ gem install chef-metal-null
Or if you have chefdk:
$ chef gem install chef-metal-null
Usage
Create a recipe, such as site.rb
with the machines you wish to converge and
the recipes or roles you wish to use:
require 'chef_metal'
with_driver 'null'
machine "mymachine.example.com" do
converge true
recipe "foo::bar"
end
And run chef-client -z site.rb
. This will ssh to the machines, bootstrap
chef, and perform the converge step. Remove converge true
if you only want
chef metal to perform a chef run once (e.g. if you're using this to perform
the initial bootstrap and some other mechanism will take care of future chef
runs).
Vagrant example
The following example will connect to a pre-existing vagrant machine (i.e. one
created outside of chef-metal). It illustrates some of the options you can
pass:
machine "vagrant" do
converge true
machine_options :username => 'vagrant',
:hostname => '127.0.0.1',
:ssh_options => {
:port => '2222',
:password => 'vagrant'
}
recipe 'test'
end
Options
You pass all options via machine_options
. The following are currently
recognized:
- hostname - the hostname to connect to. If this is left out, the name of the
machine is used.
- username - the username to connect as. If this is left out, the username of
the user running chef-client is used.
- ssh_options - a hash containing other ssh options as accepted by chef-metal
and net-ssh. The list of valid options at the time of writing is:
:auth_methods
:bind_address
:compression
:compression_level
:config
:encryption
:forward_agent
:hmac
:host_key
:keepalive
:keepalive_interval
:kex
:keys
:key_data
:languages
:logger
:paranoid
:password
:port
:proxy
:rekey_blocks_limit
:rekey_limit
:rekey_packet_limit
:timeout
:verbose
:global_known_hosts_file
:user_known_hosts_file
:host_key_alias
:host_name
:user
:properties
:passphrase
:keys_only
:max_pkt_size
:max_win_size
:send_env
:use_agent
Contributing
- Fork it ( http://github.com/mivok/chef-metal-null/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request