skip to Main Content

I’ve set a hostname which excludes a domain name I’ve been provided with. However when it connects to my puppet master, lots of code fails – eventually I’ve pinned this down the fqdn fact not returning the fully qualified domain name and instead returning the hostname. Is there anyway around this? Perhaps it’s a misconfiguration in puppet or changes to the agent.

If there isn’t, what can I do to resolve it? Should I create a new fact? Find and replace everywhere the fqdn fact is use.

[root@a /]# hostname
a.long.hostname.with.lots.of.required.fields
[root@a /]# hostname -f
a.long.hostname.with.lots.of.required.fields.areallongexample.com
[root@a /]# facter fqdn
a.long.hostname.with.lots.of.required.fields
[root@a /]# facter hostname
a
[root@a /]# facter domain
long.hostname.with.lots.of.required.fields
[centos@a ~]$ facter networking.fqdn
a.long.hostname.with.lots.of.required.fields
[centos@a ~]$ facter networking
{
  dhcp => "192.168.0.2",
  domain => "long.hostname.with.lots.of.required.fields",
  fqdn => "a.long.hostname.with.lots.of.required.fields",
  hostname => "a",
  interfaces => {
    eth0 => {
      bindings => [
        {
          address => "192.168.0.2",
          netmask => "255.255.255.0",
          network => "192.168.0.0"
        }
      ],
      dhcp => "192.168.0.1",
      ip => "192.168.0.2",
      mac => "00:00:00:00:00:00",
      mtu => 9001,
      netmask => "255.255.255.0",
      network => "192.168.0.0"
    },
    lo => {
      bindings => [
        {
          address => "127.0.0.1",
          netmask => "255.0.0.0",
          network => "127.0.0.0"
        }
      ],
      ip => "127.0.0.1",
      mtu => 65536,
      netmask => "255.0.0.0",
      network => "127.0.0.0"
    }
  },
  ip => "192.168.0.2",
  mac => "00:00:00:00:00:00",
  mtu => 9001,
  netmask => "255.255.255.0",
  network => "192.168.0.0",
  primary => "eth0"
}

2

Answers


  1. Chosen as BEST ANSWER

    I created a fact called fqdn and changed the weight for it, it simple runs hostname -f.


  2. I’ve set a hostname which excludes a domain name I’ve been provided with.

    No, you haven’t. At least not if the hostname outputs you present model the actual system configuration correctly. You’ve configured the machine with a hostname that expresses a different domain name than you were given.

    A fully-qualified domain name consists of a series of segments separated by periods (.). The first segment is a machine-specific name, and the rest is a domain name.

    It is valid and common to configure a machine such that the hostname command returns the fully-qualified domain name, and I find this easiest to work with from a Puppet perspective. Some people prefer to instead configure such that the hostname command returns the simple hostname, and this can work, too, provided that the dnsdomainname command returns the full domain.

    Facter assumes that one of those two approaches has been taken, but the outputs of your hostname and hostname -f commands show that your machine is configured differently. hostname returns a name that looks like a FQDN on account of containing period-separated segments, but it is not the machine’s FQDN. This will very likely cause trouble for more than just Puppet and Facter, which is why it is reasonable for Facter assume that machines are not configured the way yours is.

    You should fix your system configuration. If the machine’s correct FQDN is a.long.hostname.with.lots.of.required.fields.areallongexample.com then you should set either that or simply a as (its sense of) its hostname. This may require you to dump your current Puppet machine registration and re-register with the new hostname.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search