propellor-4.6.0: property-based host configuration management in haskell

Propellor.Property.Hostname

Synopsis

# Documentation

Ensures that the hostname is set using best practices, to whatever name the Host has.

Configures both /etc/hostname and the current hostname. (However, when used inside a chroot, avoids setting the current hostname as that would impact the system outside the chroot.)

Configures /etc/mailname with the domain part of the hostname.

/etc/hosts is also configured, with an entry for 127.0.1.1, which is standard at least on Debian to set the FDQN.

Also, the /etc/hosts 127.0.0.1 line is set to localhost. Putting any other hostnames there is not best practices and can lead to annoying messages from eg, apache.

Makes /etc/resolv.conf contain search and domain lines for the domain that the hostname is in.

Function to extract the domain name from a HostName.

hostname of foo.example.com has a domain of example.com. But, when the hostname is example.com, the domain is example.com too.

This doesn't work for eg, foo.co.uk, or when foo.sci.uni.edu is in a sci.uni.edu subdomain. If you are in such a network, provide your own ExtractDomain function to the properties above.