[chef] Re: Possibilities for node_name in Chef client configuration


Chronological Thread 
  • From: Adam Jacob < >
  • To: " " < >
  • Subject: [chef] Re: Possibilities for node_name in Chef client configuration
  • Date: Mon, 9 Jun 2014 08:00:11 -0700

Set node_name to what you want in /etc/chef/client.rb.

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.

Adam


On Mon, Jun 9, 2014 at 7:45 AM, Jeff Blaine < " target="_blank"> > 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: " target="_blank">



Archive powered by MHonArc 2.6.16.

§