Ask Your Question
0

Running foreman as puppet console

asked 2016-10-11 09:06:38 -0600

ddk gravatar image

updated 2016-10-11 15:15:37 -0600

DarylW gravatar image

We are setting up foreman to run as puppet console for reporting and ENC, now we are facing two problems...

  • Puppet is not able upload facts to foreman
  • Smart class parameters are not working as expected.

The instruction we have been following is https://theforeman.org/manuals/1.13/i... . And as far as we understand, the ENC script will convert agent facts to foreman format and upload it to foreman web. However it looks like this ENC only look for a client fact yaml file under /$puppetdir/yaml/facts/$certname.yaml .. which does not exist on master at all ... so no facts are uploaded to foreman.

if SETTINGS[:facts]
        req = generate_fact_request certname, "#{puppetdir}/yaml/facts/#{certname}.yaml"
        upload_facts(certname, req)
end

How to rewrite ENC to generate new agent facts during each agent run and upload them to foreman properly?

Besides, is there anyway to integrate Hiera and Foreman ENC, current setup will only load nodes definitions from hiera files, nothing configured with foreman host group and smart class parameters will apply on selected nodes.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-10-13 03:01:06 -0600

domcleal gravatar image

And as far as we understand, the ENC script will convert agent facts to foreman format and upload it to foreman web. However it looks like this ENC only look for a client fact yaml file under /$puppetdir/yaml/facts/$certname.yaml .. which does not exist on master at all ... so no facts are uploaded to foreman.

Unless you've reconfigured the Puppet master's routes, the fact files should be available under the master's vardir every time an agent checks in. e.g. with Puppet Server 2.6.0, they're usually at /opt/puppetlabs/server/data/puppetserver/yaml/facts/host.example.com.yaml. Without more information about exactly which version of Puppet you're running, I can't add much more.

How to rewrite ENC to generate new agent facts during each agent run and upload them to foreman properly?

Rewriting the ENC isn't necessary, it sounds like a configuration problem!

Besides, is there anyway to integrate Hiera and Foreman ENC, current setup will only load nodes definitions from hiera files, nothing configured with foreman host group and smart class parameters will apply on selected nodes.

Node definitions should be merged from any node definitions in the site manifests and by calling the ENC. Clearly if your ENC isn't working (above) then this won't happen - perhaps it's just that?

The merging rules are listed in External Node Classifiers: How Merging Works, but should mean the combination of classes from the ENC and node definition are applied to the host.

edit flag offensive delete link more

Comments

Thanks for your help ! Work like a charm :) So foreman definition works on top of hiera, all hiera definitions will be override if defined in foreman (at least that's what I found out) ... what's the best way to use foreman and hiera ? Should they coexist ?

ddk gravatar imageddk ( 2016-10-13 05:10:45 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-10-11 09:06:38 -0600

Seen: 239 times

Last updated: Oct 13 '16