Easy way to add a role to a new node?

Hey, everyone –

I have a bootstrap script that registers hosts with Chef when they boot.
I’d love to have this script also add a role to the newly created nodes –
in this case, a base role that includes all of the universal system
configs. Is there an easy way to do this, either by having the node tell
the chef server at registration that it has this role, or by having the
server add the role when a new node is registered?

Thanks!

  • Ian


Ian Marlier | Systems Engineer
Brightcove, Inc.
One Cambridge Center, 12th Floor, Cambridge, MA 02142
imarlier@brightcove.com

It sounds like you're doing custom a custom bootstrap, take a look at
http://wiki.opscode.com/display/chef/Knife+Bootstrap
and
http://wiki.opscode.com/display/chef/Knife+Bootstrap

You're describing what the /etc/chef/first-boot.json is used for.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Tue, Aug 30, 2011 at 12:45 PM, Ian Marlier imarlier@brightcove.com wrote:

Hey, everyone --

I have a bootstrap script that registers hosts with Chef when they boot.
I'd love to have this script also add a role to the newly created nodes --
in this case, a base role that includes all of the universal system
configs. Is there an easy way to do this, either by having the node tell
the chef server at registration that it has this role, or by having the
server add the role when a new node is registered?

Thanks!

  • Ian

--
Ian Marlier | Systems Engineer
Brightcove, Inc.
One Cambridge Center, 12th Floor, Cambridge, MA 02142
imarlier@brightcove.com