- From: Jeff Blaine <
>
- To:
- Subject: [chef] Re: Re: Possibilities for node_name in Chef client configuration
- Date: Mon, 09 Jun 2014 15:26:25 -0400
Thanks Noah and Adam.
>
Set node_name to what you want in /etc/chef/client.rb.
Well yeah, that's what I'm trying to do :)
What I've learned is that chef-client has not gathered ohai
data before it loads this config file, so ohai['fqdn'] is
not available for munging in client.rb as such:
node_name ohai['fqdn'].downcase.gsub('domain.com', '')
Not a big deal there. We already use the chef-client cookbook
and can do the munging there in our wrapper for it.
Is the node name used as any sort of *input data* for that node's
client key generation?
If so, obviously renaming our node objects is going to require
rekeying everything.
>
Or, write a library in a cookbook that is something like
>
>
```ruby
>
module Normalize
>
def site_name
>
# stuff, where @name is the node name
>
end
>
end
>
>
Chef::Node.extend(Normalize)
>
```
>
>
Then you can call it with:
>
>
```ruby
>
node.site_name
>
```
>
>
From anywhere.
... except client.rb.
>
On Mon, Jun 9, 2014 at 7:45 AM, Jeff Blaine
>
<
>
<mailto:
>>
>
wrote:
>
>
The default client.rb setting for node_name is "what Ohai determined to
>
be the FQDN of the node"
>
>
In our environment, this causes a total mess. Due to many factors
>
outside of our control:
>
>
* node['fqdn'] for some nodes is of the form: foo
>
* node['fqdn'] for some nodes is of the form: foo.DOMAIN
>
* node['fqdn'] for some nodes is of the form: foo.domain
>
>
That's a real party when using knife, let me tell you.
>
>
Because of this, we clearly want to normalize our node *object* names.
>
>
How does one reference the current node object in client.rb so that I
>
can effectively do something like:
>
>
def site_normalize
>
# stuff
>
end
>
>
node_name site_normalize(the_node_fqdn)
>
>
>
>
>
--
>
Opscode, Inc.
>
Adam Jacob, Chief Dev Officer
>
T: (206) 619-7151 E:
>
>
>
<mailto:
>
Archive powered by MHonArc 2.6.16.