Can I set fqdn for chef nodes?

nroose picture nroose · Feb 11, 2013 · Viewed 16.1k times · Source

I have several servers set up with a custom internal local domain - x.local. So I have servers s1.x.local, etc. My knife reports the fqdn as s1.domain.com. Can I change that without changing the names the servers think they have? Or do I need to actually change the server names? Thanks.

Answer

Jordan Dea-Mattson picture Jordan Dea-Mattson · Feb 26, 2013

You can, but it will not stay set to the value you give it.

The FQDN attribute is what is known as an automatic attribute in Chef. It is set by Ohai each and every time Ohai runs.

Therefore, while you can change the value of the FQDN attribute, the next time Ohai runs, it will set it back to be the value returned by hostname --fqdn.

Therefore, as noted above, if you want to change the FQDN attribute permanently, you will need to change the hostname.