saltstack-formulas / hostsfile-formula

Use minion IDs to keep /etc/hosts and hostnames consistent for clusters without DNS
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
33 stars 89 forks source link

Short hostname, not FQDN, for Debian and Ubuntu #21

Closed pedrohdz closed 7 years ago

pedrohdz commented 7 years ago

Debian/Ubuntu use a short hostname, not the FQDN. References below:

https://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_the_hostname

The kernel maintains the system hostname. The init script in runlevel S which is symlinked to "/etc/init.d/hostname.sh" sets the system hostname at boot time (using the hostname command) to the name stored in "/etc/hostname". This file should contain only the system hostname, not a fully qualified domain name.

http://manpages.ubuntu.com/manpages/trusty/man1/hostname.1.html

/etc/hostname Historically this file was supposed to only contain the hostname and not the full canonical FQDN. Nowadays most software is able to cope with a full FQDN here. This file is read at boot time by the system initialization scripts to set the hostname.

gravyboat commented 7 years ago

Hmm, why the modification to the redhat section if it doesn't get changed at all?

pedrohdz commented 7 years ago

Assuming you are referring to my renaming fqdn to hostname, putting the short name in the fqdn variable just seems confusing. fqdn is FQDN, not a short name where as a hostname can be either the short name or the FQDN depending on the distribution.

As far as I can tell I only changed the variable name in the Redhat section, unless I slipped up?

pedrohdz commented 7 years ago

I can change it back, or split it into two commits if needed?

gravyboat commented 7 years ago

Nah it doesn't really matter. I just wasn't sure if there was a reason for the change. Thanks for working on this.

iggy commented 7 years ago

It would be nice if there was a way to override this new functionality that changed backward compatibility. We actually put a shortened version of the fqdn in for hostname, and this would break that.

i.e. hostname = saltmaster.pop - fqdn = saltmaster.pop.example.com

pedrohdz commented 7 years ago

Howdy! Sorry about the lagged response, holidays.

How about defaulting to the new "correct" behavior, and adding a switch to turn it off? Set the switch to have it use the old behavior on Ubuntu. Maybe call it debian_fqdn_hostname?