- From: John Merrells <
>
- To:
- Subject: [chef] Re: Ideas on kickstarting a node and auto-applying a role
- Date: Fri, 14 May 2010 11:37:22 -0700
On May 14, 2010, at 11:11 AM, Paul Choi wrote:
>
We want to be able to do something similar with Chef - the goal being,
>
kickstart a host, then install Chef RPMs, then the host should just
>
automagically get configured according to its IP, hostname, or some kind of
>
identifying criteria. Any ideas on how to do this?
I'm doing this, so it is possible.
>
So far, the workflow that Chef expects is:
>
- install chef-client on node.
>
- chef-client auto-registers itself with either validation cert or password
>
- Use knife to apply role(s) to the newly created node
This is what I do, except for the last part.
I have a separate piece of code that is driven by a data file that maps
virtual hosts onto virtual servers onto physical machines. The code sets up
the name servers, creates the machines through my hosting provider API and
sets up the roles for the servers in chef. You can actually create the nodes
before the client actually connects for the first time. The common key
between the virtual and the physical is the hostname of the machine. I know
what the machine name will be e.g 'webserver6' and the boot script names the
machine that before the chef client code is installed.
>
It's the manual application of role(s) to the newly created node that I
>
would like to see automated. I don't think there's a way in Chef to set a
>
rule saying, "if a host is in 10.1.12.* subnet, apply role[a], role[b],
>
role[z], etc". If I can figure out this last step, life would be just
>
awesome. :)
You might be able to do this by writing some ruby code in a role file.....
I'm not sure how the chef client determines which cookbooks to download from
the server... it might be static.... others on the list can probably answer
this.
However, I'd have thought that basing roles on ip addresses is going to
remove some flexibility that you might need later on.
John
--
John Merrells
http://johnmerrells.com
+1.415.244.5808
Archive powered by MHonArc 2.6.16.