On Wed, 2017-07-05 at 08:45 -0700, Brian McArdle wrote:
> Is my understanding above all correct? Is there a shortcut that I'm
> missing to finding out what values a host is using for a class?

It's already in the ENC data that Foreman sends to Puppet (assuming the
host is in the hostgroup in question). When the ENC YAML is compiled,
Foreman will parse the parameters from least specific to most specific,
overriding ones with the same name as it goes. So if your hostgroup has
"class foo -> parameter bar = quux" you should see that on your host
directly (check the YAML button on the host page). But if the host has
"class foo -> parameter bar = qaaz" then you'll see that instead. The
exact hierarchy is listed in the manual, see:

https://theforeman.org/manuals/1.15/#4.2.3Parameters

You don't actually say *where* you're trying to consume this data
though. I assume you're wanting it in Puppet, which should work out of
the box - anything in the ENC is passed to Puppet and should be used
directly. If you want to access it in templates, you can use "<%=
host_enc %>" (via http://projects.theforeman.org/projects/foreman/wiki/
TemplateWriting#Functions-and-macros), and from some other place, there
is an API call to get the host's ENC data (GET /api/hosts/:id/enc)

If want to access data for other hosts / hostgroups in Puppet
manifests, there are ways - but for brevity I'll not go into to that
yet. If that's what you're actually looking for, shout out :)

Greg

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to