# Chef server name attribute?

**URL:** <https://discourse.chef.io/t/chef-server-name-attribute/2392>\
**Category:** Chef Infra (archive)\
**Created:** [January 26, 2012, 2:14pm UTC](https://discourse.chef.io/t/chef-server-name-attribute/2392 "2012-01-26T14:14:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [January 26, 2012, 2:14pm UTC](https://discourse.chef.io/t/chef-server-name-attribute/2392/1 "2012-01-26T14:14:01Z")

</div>

Fellow Chef’s:

Is there any attribute that contains the chef server fqdn on the client node? I would like to add it into the template so that humans would know which chef server is managing that node. I know they could look in the /etc/chef/client.rb , but, it would be nice to use something like the following:

# Warning: This file is managed by the Chef server \<% node[‘chefserver’] %\> on node \<%= node[‘fqdn’] %\>!

I also know I could code for it, but I am looking for the best way so as to keep the chef runs as efficient as possible.

Thanks,  
Randy

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [January 26, 2012, 2:31pm UTC](https://discourse.chef.io/t/chef-server-name-attribute/2392/2 "2012-01-26T14:31:06Z")

</div>

Randy,  
You should be able to to grab it from the Chef::Config object

# Warning: This file is managed by the Chef server \<%= Chef::Config[:chef\_server\_url] %\> on node \<%= node['fqdn'] %\>!

Take a look at the chef-client and pxe\_dust cookbooks for more example usage:  
[https://github.com/opscode/cookbooks/blob/master/chef-client/templates/default/client.rb.erb#L4-6](https://github.com/opscode/cookbooks/blob/master/chef-client/templates/default/client.rb.erb#L4-6)  
[https://github.com/opscode/cookbooks/blob/master/pxe\_dust/templates/default/chef-bootstrap.sh.erb#L19](https://github.com/opscode/cookbooks/blob/master/pxe_dust/templates/default/chef-bootstrap.sh.erb#L19)

--  
Seth Chisamore  
Software Design Engineer, Opscode, Inc.  
IRC, Skype, Twitter, Github: schisamo

On Thursday, January 26, 2012 at 6:14 AM, Van Fossan,Randy wrote:

> Fellow Chef's:
> 
> Is there any attribute that contains the chef server fqdn on the client node? I would like to add it into the template so that humans would know which chef server is managing that node. I know they could look in the /etc/chef/client.rb , but, it would be nice to use something like the following:
> 
> # Warning: This file is managed by the Chef server \<% node['chefserver'] %\> on node \<%= node['fqdn'] %\>!
> 
> I also know I could code for it, but I am looking for the best way so as to keep the chef runs as efficient as possible.
> 
> Thanks,  
> Randy

---

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [January 26, 2012, 2:49pm UTC](https://discourse.chef.io/t/chef-server-name-attribute/2392/3 "2012-01-26T14:49:46Z")

</div>

Thanks Seth… Where did you find the information on the Chef::Config object ?? I am still a newbie on chef… :O)

I need to parse that URL to just the fqdn.

From: Seth Chisamore [[mailto:schisamo@opscode.com](mailto:schisamo@opscode.com)]  
Sent: Thursday, January 26, 2012 9:31 AM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Chef server name attribute?

Randy,

You should be able to to grab it from the Chef::Config object

# Warning: This file is managed by the Chef server \<%= Chef::Config[:chef\_server\_url] %\> on node \<%= node[‘fqdn’] %\>!

Take a look at the chef-client and pxe\_dust cookbooks for more example usage:

[https://github.com/opscode/cookbooks/blob/master/chef-client/templates/default/client.rb.erb#L4-6](https://github.com/opscode/cookbooks/blob/master/chef-client/templates/default/client.rb.erb#L4-6)

[https://github.com/opscode/cookbooks/blob/master/pxe\_dust/templates/default/chef-bootstrap.sh.erb#L19](https://github.com/opscode/cookbooks/blob/master/pxe_dust/templates/default/chef-bootstrap.sh.erb#L19)

–

Seth Chisamore

Software Design Engineer, Opscode, Inc.

IRC, Skype, Twitter, Github: schisamo

On Thursday, January 26, 2012 at 6:14 AM, Van Fossan,Randy wrote:

```
Fellow Chef's:

 

Is there any attribute that contains the chef server fqdn on the client node? I would like to add it into the template so that humans would know which chef server is managing that node. I know they could look in the /etc/chef/client.rb , but, it would be nice to use something like the following:

 

# Warning: This file is managed by the Chef server <% node['chefserver'] %> on node <%= node['fqdn'] %>!

 

I also know I could code for it, but I am looking for the best way so as to keep the chef runs as efficient as possible.

 

Thanks,

Randy
```

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [January 26, 2012, 2:54pm UTC](https://discourse.chef.io/t/chef-server-name-attribute/2392/4 "2012-01-26T14:54:08Z")

</div>

The best place to start is the 'Chef Configuration Settings' wiki page:  
[http://wiki.opscode.com/display/chef/Chef+Configuration+Settings](http://wiki.opscode.com/display/chef/Chef+Configuration+Settings)

--  
Seth Chisamore  
Software Design Engineer, Opscode, Inc.  
IRC, Skype, Twitter, Github: schisamo

On Thursday, January 26, 2012 at 6:49 AM, Van Fossan,Randy wrote:

> Thanks Seth.. Where did you find the information on the Chef::Config object ?? I am still a newbie on chef.. :O)
> 
> I need to parse that URL to just the fqdn.
> 
> From: Seth Chisamore [[mailto:schisamo@opscode.com](mailto:schisamo@opscode.com)]  
> Sent: Thursday, January 26, 2012 9:31 AM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com) ([mailto:chef@lists.opscode.com](mailto:chef@lists.opscode.com))  
> Subject: [chef] Re: Chef server name attribute?
> 
> Randy,
> 
> You should be able to to grab it from the Chef::Config object
> 
> # Warning: This file is managed by the Chef server \<%= Chef::Config[:chef\_server\_url] %\> on node \<%= node['fqdn'] %\>!
> 
> Take a look at the chef-client and pxe\_dust cookbooks for more example usage:
> 
> [https://github.com/opscode/cookbooks/blob/master/chef-client/templates/default/client.rb.erb#L4-6](https://github.com/opscode/cookbooks/blob/master/chef-client/templates/default/client.rb.erb#L4-6)
> 
> [https://github.com/opscode/cookbooks/blob/master/pxe\_dust/templates/default/chef-bootstrap.sh.erb#L19](https://github.com/opscode/cookbooks/blob/master/pxe_dust/templates/default/chef-bootstrap.sh.erb#L19)
> 
> --
> 
> Seth Chisamore
> 
> Software Design Engineer, Opscode, Inc.
> 
> IRC, Skype, Twitter, Github: schisamo
> 
> On Thursday, January 26, 2012 at 6:14 AM, Van Fossan,Randy wrote:
> 
> > Fellow Chef's:
> > 
> > Is there any attribute that contains the chef server fqdn on the client node? I would like to add it into the template so that humans would know which chef server is managing that node. I know they could look in the /etc/chef/client.rb , but, it would be nice to use something like the following:
> > 
> > # Warning: This file is managed by the Chef server \<% node['chefserver'] %\> on node \<%= node['fqdn'] %\>!
> > 
> > I also know I could code for it, but I am looking for the best way so as to keep the chef runs as efficient as possible.
> > 
> > Thanks,
> > 
> > Randy
