0

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 ...)

Stephen C
  • 551
  • 4
  • 18

1 Answers1

1

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.

zts
  • 945
  • 5
  • 8
  • 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 02:24