Search code examples
puppet

Puppet fact for fqdn doesn't return the fully qualified domain name


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"
}

Solution

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