Puppet not finding facts in manifests but 'facter <fact>' from the command line works just fine.

asked 2018-06-04 19:32:39 -0500

bschonecker gravatar image

I've got multiple [sudden] problems with my Puppet server (open source). I have a very easy manifest:

notify { 'FqdnTest':
    withpath => true,
    name     => "my fqdn is ${::fqdn}",

When I run this manifest, I get:

[root@rbpups01 bschonecker]# puppet apply -t fqdn.pp
Warning: Unknown variable: '::fqdn'. (file: /home/bschonecker/fqdn.pp, line: 3, column: 31)
Notice: Compiled catalog for rbpups01.example.local in environment production in 0.16 seconds
Info: Caching catalog for rbpups01.example.local
Info: 'replace_catalog' command for rbpups01.example.local submitted to PuppetDB with UUID 25d52610-31c5-4872-b30f-1580c02ae1b2
Info: Applying configuration version 'rbpups01-production-11fc68b283d'
Notice: /Stage[main]/Main/Notify[FqdnTest]/message: my fqdn is 
Notice: /Stage[main]/Main/Notify[FqdnTest]/message: defined 'message' as 'my fqdn is '
Notice: Applied catalog in 0.12 seconds

But when I do a simple 'facter fqdn' I get what I expect:

facter fqdn

No other server is experiencing this problem.

 rpm -qa | grep puppet | sort
edit retag flag offensive close merge delete


did you try `puppet lookup fqdn` ? If that works, it may be that you need to reference the fact in your puppet code using the facts hash, so do `$facts['fqdn']` and see if that works. https://puppet.com/docs/puppet/5.3/lang_facts_and_builtin_vars.html#the-factsfactname-hash

DarylW gravatar imageDarylW ( 2018-06-05 07:54:02 -0500 )edit