Let me walk you through my steps.
I run a recipe with creates a /etc/hosts file, and puts it in this format; note the alias (nodex) after the IP. I NEED it in this format!
10.22.10.10 nodex server1-nodex.domain.com
Just to test, I stat over, but create the /etc/hosts file in this format; note the alias now appears after the FQDN in the line (I don't need it this way)
10.22.10.10 server1-nodex.domain.com nodex
Now if I do a knife node show node_name, Chef shows the correct FQDN, so does "hostname -f"
Why does Chef do this to my FQDN based on what's in the /etc/hosts file? I have a pre-Chef configuration process (shell scripts) that configures the /etc/hosts file the way I want it, and the FQDN does NOT get affected?
Is this a "bug" or at least an undesirable side effect in Chef?
I am pretty sure this is not Chef's fault, but the init scripts on your Linux box. They read
/etc/hosts
to determine how to set the hostname.
Look in /etc/sysconfig/network-scripts
You should be able to override this in /etc/sysconfig/network
.