[chef] Re: Re: Re: Re: How can I set the hostname of a node via a recipe?


Chronological Thread 
  • From: Gilles Devaux < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: How can I set the hostname of a node via a recipe?
  • Date: Wed, 17 Nov 2010 11:44:40 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=RuMvrlOjITo/E/XqThQ/GVPcpoBHPTiDvRIIpvsJnJ7BTZlNpM+pJ7wzlRryBBwb6/ 9fnrgqFAiHMnbHoiSPZDnrY8gDjmgf8iah4PZVzrzSXp8Lu9zhoRrUHIlopj8m59/3nX Xp/Czarzli/SPpwX6as6ImeKKQca49JIlVh90=

I have a cookbook to set /etc/hosts, not sure if it's been pulled on the main cookbooks repo

https://github.com/peerpong/cookbooks/tree/hosts/hosts/

-> works with rackspace or no cloud provider. Feel free to update or modify

--Gilles

On Wed, Nov 17, 2010 at 9:04 AM, Daniel DeLeo < "> > wrote:


On Tue, Nov 16, 2010 at 11:24 PM, Joshua Miller < " target="_blank"> > wrote:
Given that Chef uses the host name as its primary identifier you better be careful.  You should set the name during build or if you must then use a different primary key

    -N, --node-name NODE_NAME        The node name for this client

http://wiki.opscode.com/display/chef/Chef+Client

or node_name in the client.rb

http://wiki.opscode.com/display/chef/Chef+Configuration+Settings

I have always thought the mac address would make a much better uniq id, and then use node[:fqdn] for gui / knife output. 

I think the best ID to use really depends on your infrastructure. Using the hostname works really well when you have a small-ish number of semantically (or whimsically) named boxes (like app1.example.com or centaur.example.com) where everyone knows the boxes by name. If you're on EC2, then instance ids are a good choice (same with other cloud providers and their unique ids). In a large setup with tons of physical boxes that PXE boot, you might do something different or roll your own guid service (and you couldn't use MAC addresses either).

So it's really all about the tradeoffs for your environment.

 

Joshua

On 17 November 2010 19:46, < " target="_blank"> > wrote:

Is it possible to set the hostname via a recipe? If so does a cookbook exist
already, I couldnt find one before.

Cheers
Jono

As mentioned earlier, changing the hostname is as simple as managing whatever files your distro/OS uses to set the hostname, but if you're planning to do this, set the node name in the client.rb when you first register the node.

Dan DeLeo 





Archive powered by MHonArc 2.6.16.

§