[chef] Re: Default roles for new chef clients?


Chronological Thread 
  • From: Joshua Miller < >
  • To:
  • Subject: [chef] Re: Default roles for new chef clients?
  • Date: Fri, 23 Jul 2010 21:29:07 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:message-id :references:to:x-mailer; b=FLOPlqaT3mmY31UvG/Xcwymoy0QIO82NL1kQstFOtKEQVAieyL7fwy30K4QkeHkGf2 rl1EENGE1xkJyyXCsJ8JGXRnRXbMvgAV71RiUZSLUiK8k8iBiO1GZjg+hCE8TBSSek2b PRiTci+X8K9RN37OAIKREVHpeV/mUaIs6cLPA=

So this a post install script that I run in my pxe boots, I know there are other ways but hey it works for me.


Joshua

### chef pxe with BASE_ROLE

apt-get update

echo "chef chef/chef_server_url string http://chef.int.rdio:4000" | debconf-set-selections 

apt-get install -y chef


#Add to correct roles in chef based on Kickstart Meta Data
cat <<EOF > /root/client.json
{
 "run_list": [ "role[BASE_ROLE]" ]
}
EOF


cat <<EOF > /etc/chef/validation.pem
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAtZiqYCINmpS85lkCOcO16apn9ssvLBcKwHoehJ4J+He2zj6a
REMOVED
E4upmisnerbcvdqQ7TffXSfqsLD6jv4ofY2jvuMuIE4ZFCEY1BDqBg==
-----END RSA PRIVATE KEY-----
EOF

# register with the server
chef-client -j /root/client.json

sleep 30
# We run one more time to make sure its all good
chef-client
sleep 30
chef-client



### end chef pxe with BASE_ROLE




On Jul 23, 2010, at 9:17 PM, Leinartas, Michael wrote:

I'm just getting started with chef and trying to figure out how it will fit into our infrastructure.  Currently I have things set up so that when a new box is created, chef is installed and the client is started with the master server configured.  I'd like to use chef to do some further bootstrapping of the server (e.g. set default firewall rules, add users and copy their keys, install some packages).  My question is, is there a way for me to specify a default role for new clients that would have the recipes for these tasks configured?

Is this reasonable? Appropriate? Any solutions, ideas, or other comments appreciated.

michael




Archive powered by MHonArc 2.6.16.

§