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.
Asked
Active
Viewed 1.7k times
9
-
Actually, if I do the `hostname` command on the clients, I get the local address. Why is the chef server reporting the fqdn as domain.com? – nroose Feb 11 '13 at 21:52
-
Try `hostname -f`, chances are that will return `s1.domain.com`. Chef is merely using what the OS is returning; if you don't like that, look for a distro-specific way of "fixing" that. – Andrea Campi Feb 12 '13 at 14:01
-
hostname -f is returning s1.x.local. – nroose Feb 13 '13 at 04:16
-
Chef (and knife) rely on Ohai to provide node system attributes. As you see here https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/linux/hostname.rb _fqdn_ value comes from running `hostname --fqdn`. If you want to change what knife gives you, you have to change the server hostname. – Draco Ater Feb 13 '13 at 22:07
-
@DracoAter, that's not exactly true. The command `hostname --fqdn` relies on the resolver. If you don't change the dns record or /etc/hosts, for the interface, the hostname will change but fqdn won't. – Philip C Oct 24 '13 at 17:22
1 Answers
14
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.

Jordan Dea-Mattson
- 5,791
- 5
- 38
- 53