Default roles for new chef clients?


#1

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


#2

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 < /root/client.json
{
“run_list”: [ “role[BASE_ROLE]” ]
}
EOF

cat < /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


#3

This is about what I was looking for, thanks


From: Joshua Miller jassinpain@gmail.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Fri, 23 Jul 2010 23:29:07 -0500
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] Re: Default roles for new chef clients?

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 < /root/client.json
{
“run_list”: [ “role[BASE_ROLE]” ]
}
EOF

cat < /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