Hello
I followed this guide https://www.theforeman.org/manuals/1.15/index.html#3.5.5FactsandtheENC to load agent facts but still cannot see them on the board.
Copied the node.rb to /etc/puppetlabs/puppet/
[main]
server = puppet
environment = production
runinterval = 10m
strict_variables = true
[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
# For puppet DB
storeconfigs = true
storeconfigs_backend = puppetdb
reports = store,puppetdb,foreman
external_nodes = /etc/puppetlabs/puppet/node.rb
node_terminus = exec
I see no errors from the agents , also executed it manually as suggested in the documentation and this is what I get.
./node.rb puppetserver.domain.lan
---
classes: []
parameters:
puppetmaster: ''
root_pw:
foreman_subnets: []
foreman_interfaces:
- ip:
ip6:
mac:
name: puppetserver.domain.lan
attrs: {}
virtual: false
link: true
identifier:
managed: true
primary: true
provision: true
subnet:
subnet6:
tag:
attached_to:
type: Interface
foreman_config_groups: []
Also executed --push-facts and no luck, Am I missing something else?
puppetserver version: 5.1.4
Foreman version Version 1.15.6
CentOS Linux release 7.4.1708 (Core)
Thanks
Regards
First stop would be the Foreman logs - tail production.log
and call the ENC, and show us whatâs logged during the test.
Iirc 1.16 added puppet 5 support so that might be related
Do the directories you have configured in puppet.conf match those in puppetserver.conf? Had this and reports not work a few times due to small directory differences⌠you should also see API call in production.log if itâs trying and failingâŚ
I just found the same issue too.
check âpuppetdirâ in foreman.yaml, which is â/var/lib/puppetâ by default.
but in puppet 4 or higher, facts are cached in $vardir by default, it could be found under â/opt/puppetlabs/server/data/puppetserver/yaml/factsâ.
so edit foreman.yaml and set " :puppetdir: â/opt/puppetlabs/server/data/puppetserverâ ", then it would be ok.
Iâm not so good at English, hope this could help.
thanks.
1 Like
Thanks buddy , that did the trick!!! really appreciated your help
Regards
Was this an upgrade from an older Puppet/Foreman version combination? Those paths should already be correct on a fresh install, at least
Hi
This was a fresh install and I installed it on a running puppet server like this:
foreman-installer --foreman-db-host=x.x.x.x --foreman-db-type=postgresql --foreman-db-database=foreman --foreman-db-adapter=postgresql --foreman-db-username=foreman --foreman-db-password=secretpassword --foreman-admin-email=user@domain.com --foreman-admin-password=SZENhbFNvdddQCzXH8u --foreman-admin-username=foremanadmin --no-enable-puppet --foreman-db-manage=false
Thanks
Regards
Interesting - I would guess that itâs because the Puppet 5 support came in 1.16, and it therefore fell back on the defaults. Probably not a big issue since 1.17 is imminent, which will render 1.15 out of support 
One issue Im having now is that I have a custom fact called environment which I assign a value, for example prod , qa, test and I use it to customize my puppet configuration based on those , and puppet agent for some reason is not taking into account itâs own configuration, so instead of looking for production for example, it looks for the value assigned to that fact, and that broke everything, so I disable it by now.
Thanks
Regads
In general, Iâd be careful naming things after core puppet concepts. I would entirely expect having a fact called âenvironmentâ to clash with the environment value set by the server, since they share the same global namespace. Call your fact âmy_environmentâ or similar to avoid clashing.
Yup, Im gonna rename it to something else.
Thanks for your time.
Regards
Hey buddy , sorry for disturbing you.
Im still having the same issue,. the agent complains about an environment value with does . not exist, but this time I renamed the fact to custom_environment and also removed it and still is overriding the agent environment variable configuration, any suggestion?
Should I remove all the content from /opt/puppetlabs/server/data/puppetserver/yaml/foreman and /opt/puppetlabs/server/data/puppetserver/yaml/facts ? It seems to be cached, just guessing here, and not being update.
If I execute node.rb and any hostname for example I get
---
classes: {}
parameters:
puppetmaster: puppetserver.domain.lan
domainname: domain.lan
root_pw:
puppet_ca: puppetserver.domain.lan
foreman_env: qa
foreman_subnets: []
foreman_interfaces:
- ip:
ip6:
mac: 0e:53:5f:a4:2f:65
name: qa-tomcat-1a_i-e73ea3f1.domain.lan
attrs: {}
virtual: false
link: true
identifier: eth0
managed: true
primary: true
provision: true
subnet:
subnet6:
tag:
attached_to:
type: Interface
foreman_config_groups: []
environment: qa
Thanks
Regards