Skip to content

Commit

Permalink
register new vm at chef server (main host must have admin client!!!)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklas committed Jul 28, 2010
1 parent fa9a48c commit de77fc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
= DESCRIPTION:
Creates RootFS for virtual machines used by LXC (Linux Containers)
Creates RootFS for virtual machines used by LXC (Linux Containers) and provisions them until they are registered at the same chef server.

= REQUIREMENTS:
* debootstrap
* ...

= WARNING:

You must make Client of the Host an Admin in the Chef WebUI, else it cannot register the VMs as new clients.

= ATTRIBUTES:

= USAGE:

Create a databag called +virtual_machines+ and create machines with the following attributes:

* :id
* :domain (optional)
* :variant (optional - minbase)
* :suite (optional - lucid)
* :ip4v
* :cidr (i.e. 192.168.168.100/24)


Details following..

7 changes: 7 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,11 @@
source 'rootfs/chef-install.conf.erb'
variables :host => host, :guest => guest
end

execute "register vm at chef server" do
private_key = rootfs / 'etc' / 'chef' / 'client.pem'
command %Q~knife client -u #{node[:fqdn]} -k /etc/chef/client.pem --no-editor create #{hostname} -f #{private_key}~
action :run
not_if "test -f #{private_key}"
end
end

0 comments on commit de77fc0

Please sign in to comment.