Puppet/Facter “Could not retrieve fact fqdn”: How to fix or circumvent?

后端 未结 6 1707
庸人自扰
庸人自扰 2020-12-23 19:28

I\'m learning about puppet and trying to experiment with it on a VM at home. I\'m not using a puppet server yet, just running things locally. It works okay, but every time I

相关标签:
6条回答
  • 2020-12-23 20:04

    Adding

      config.vm.hostname = "vagrant.example.com"
    

    to my Vagrantfile fixed it for me.

    0 讨论(0)
  • 2020-12-23 20:07

    I got the same error when running puppet on my home machine (Xubuntu). What worked for me was changing the second line of file /etc/hosts. The first two lines before the change:

    127.0.0.1   localhost
    127.0.1.1   box
    

    And after the change:

    127.0.0.1   localhost
    127.0.1.1   box.example.com box
    

    Now, the command hostname -f returns box.example.com instead of box, and puppet is happy.

    0 讨论(0)
  • 2020-12-23 20:09

    append this line into /etc/resolv.conf

    domain abc.com
    

    run facter fqdn again

    Fqdn requires domain name , which maybe missing in your freshly installed ubu12

    0 讨论(0)
  • 2020-12-23 20:16

    Since puppet uses the fqdn fact to determine which node it is running as, it may not be possible to run if it can't be determined. Given what you're describing, the simplest thing to debug is facter fqdn instead of your puppet command-line.

    If the "several seconds" is very close to exactly 5 seconds, it's very likely that your DNS configuration is broken with a single bad DNS server listed. What's in /etc/resolv.conf? What happens if you run dig -x $HOSTIP $DNSSERVERIP with the first nameserver listed in resolv.conf?

    If you look in facter/fqdn.rb you can see what exactly facter is trying to do to resolve the fqdn. In the version I have most handy it's using facter/hostname.rb and facter/domainname.rb which call code from facter/util/resolution.rb.

    Exactly what happens will depend on what version of facter you have, what OS, and possibly also what exactly you have installed. Calling /bin/hostname, uname (etc) and doing DNS lookups are all quite likely. You can always use strace -t facter fqdn to see what is taking the time (look for the gap in timestamps)

    From everything you've described, it does sound like the problem is that puppet/facter really wants to have a domain name and you don't have one, you just have a naked hostname.

    Adding domain example.com to /etc/resolv.conf should do the trick. Running hostname foo.example.com should also do the trick (but will need to be re-applied). Permanent solutions depend on the exact OS setup.

    0 讨论(0)
  • 2020-12-23 20:22

    Another possible way to circumvent is to override the fact.

    http://www.puppetcookbook.com/posts/override-a-facter-fact.html

    FACTER_fqdn=box.example.com facter
    

    On Windows this would be

    SET FACTER_fqdn=box.example.com
    facter fqdn
    
    0 讨论(0)
  • 2020-12-23 20:26

    FQDN stands for "fully qualified domain name". In a Windows domain (or other similar LDAP-based domain), for example, it would be the name of your network domain, such as "organization.internal" - the domain that your computers and servers are joined to, and the domain which contains your network groups and user accounts.

    So, it probably had trouble getting the fqdn for some authentication needed to perform the rest of the configuration steps, would be my guess.

    http://en.wikipedia.org/wiki/Fully_qualified_domain_name

    It's possible that you'll get a better answer on ServerFault, since system/configuration management also crosses over into their realm.

    0 讨论(0)
提交回复
热议问题