Fix #4465 update /etc/hosts on rhel 7 and derivatives (CentOS)

the previous fix for #4465 assumed that the NetworkManager takes care of updating /etc/hosts with
the new hostname, but testing shows it doesn't. This change ensures that the change is always added
to /etc/hosts when the name changes.