Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Chef Node that I'm initially setting up on one network that I need to (physically) move to another network. When this happens, I want the IP address and domain name to change, and the Node name and simple hostname to stay the same.

I know I can do this by deleting the Chef Node and recreating it. Could I also do it by editing Node attributes? Or would that break the client keys or (worse still) the server?

(I'm using Chef 10.16.2 ...)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Recreating the node (and client) with the new name is one option, but you can preserve the ones you already have. This requires client configuration - by the time the node retrieves attributes from the Chef server, it's already decided what its name is.

By default, chef-client will set the node name to the fully-qualified domain name of the host, as returned by ohai. You can check what name will be used by invoking ohai directly:

zts@chef ~ % ohai fqdn
[
  "chef.nat0.cryptocracy.com"
]

If that changes when you move the host, you'll need to edit /etc/chef/client.rb to set the desired nodename:

node_name "mynode.example.com"

Take a look at Chef Docs - client.rb for more about this configuration file.

share|improve this answer
    
Yup. It just worked. (I didn't need to tweak the node name. I deliberately didn't use the fqdn as node name when I created it in the first place because I knew it would be changing.) –  Stephen C Jan 25 '13 at 2:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.