So wondering if getting a list of "applied classes" into foreman is doable

It seems to me that making this data queryable, would certainly
useful, but I'm trying to suss out if it is technically feasible.

We know that /var/lib/puppet/state/classes.txt contains a full list of
classes that are applied against the node. (vs. the classes foreman is
aware of through the ENC feature).

I'm wondering if there is any sane approach to get the puppet master
to upload that data to Foreman during the puppet run. In the past, we
extended the ENC script to include facts upload, but I don't think
there is an easy approach here.

The unfortunate fact is classes.txt is generated during a puppetrun,
however so are the puppet reports? (I'm feeling like a good general
solution should just touch foreman and the puppetmaster(s), and not
require client tweaks.)

Thanks,
Brian

It's worse than that - classes.txt is on the agent, and isn't uploaded to
the master. You'd have to get puppet to send that to the master before the
master could report it to Foreman. If you can solve that, then it should be
possible to extend our report processor to get the info from disk and
include it in the report, but last time I looked I couldn't find any way to
get the client to send it.

Greg

··· On 30 October 2014 12:43, Brian Gupta wrote:

It seems to me that making this data queryable, would certainly
useful, but I’m trying to suss out if it is technically feasible.

We know that /var/lib/puppet/state/classes.txt contains a full list of
classes that are applied against the node. (vs. the classes foreman is
aware of through the ENC feature).

I’m wondering if there is any sane approach to get the puppet master
to upload that data to Foreman during the puppet run. In the past, we
extended the ENC script to include facts upload, but I don’t think
there is an easy approach here.

I guess you have a few main possibilities:

  1. have a storeconfigs backend configured on the Puppet master which
    doesn't store the whole catalog, but just the classes in it. I don't
    think that could co-exist with another storeconfigs impl (i.e. PuppetDB
    or AR). That'd be some custom module you'd install on the master and an
    API of some sort on the Foreman side to receive it, like reports or facts.

  2. Enhance the Puppet reports sent from the client to include the
    information, but that'd probably be duplicating the catalog.

  3. Some custom extension on the Puppet master, similar to (1) but not
    using the storeconfigs extension point. Maybe some custom terminus that
    just intercepts the information needed and doesn't get in the way.

  4. Have Foreman pull that information from PuppetDB when some method on
    the host object is called (like all_puppetclasses, but that may have ENC
    side effects), or just when searching. It could be added to the
    puppetdb_foreman plugin.

··· On 30/10/14 12:43, Brian Gupta wrote: > It seems to me that making this data queryable, would certainly > useful, but I'm trying to suss out if it is technically feasible. > > We know that /var/lib/puppet/state/classes.txt contains a full list of > classes that are applied against the node. (vs. the classes foreman is > aware of through the ENC feature). > > I'm wondering if there is any sane approach to get the puppet master > to upload that data to Foreman during the puppet run. In the past, we > extended the ENC script to include facts upload, but I don't think > there is an easy approach here. > > The unfortunate fact is classes.txt is generated during a puppetrun, > however so are the puppet reports? (I'm feeling like a good general > solution should just touch foreman and the puppetmaster(s), and not > require client tweaks.)


Dominic Cleal
Red Hat Engineering

1 Like