facters or Custom Facts

39 views
Skip to first unread message

warron.french

unread,
Mar 30, 2017, 7:43:21 AM3/30/17
to puppet...@googlegroups.com
I need to develop a conditional that will allow me to deploy audit.rules, auditd.conf, and IF (and only if) the machine is a Server audispatch configurations.

The ausyscalls for RHEL6 are different from RHEL7, so I require the ability "deploy" audit.rules.el7 into the correct place, and audit.rules.el6 into the appropriate place for RHEL6 (they aren't the same place).

I am working with Red Hat Enterprise Linux only; not any of the variants.

So, I figured I would develop a CASE statement based on the following strings; hopefully derived from Puppet builtin facter facts:

RHEL-6-Server
RHEL-6-Client|RHEL-6-Desktop
RHEL-7-Server
RHEL-7-Client|RHEL-7-Desktop

The problem is I cannot derive a string that looks like this in any order of the hyphenated parts, or without for that matter.

I found 1 facter that has the parts I need, that might enable me to generate the string(s) I need; but I don't know how to tease out the values from the particular facter = os.

The facter, os, offers something I can use (puppet-facter syntax not specifically used below):
  • os/release/major would give me a 6 or a 7;
  • os/distid
Can someone help me generate these strings; even if looked like RHEL-Server-6, that would be something I could work with in my class.

Oh!  Red Hat offers a file called /etc/system-release-cpe; but they didn't bother to enforce consistency in either the values as formatted or the order in which certain data is arranged within the same variables.


Thanks in advance,

--------------------------
Warron French

Rob Nelson

unread,
Mar 30, 2017, 9:58:40 AM3/30/17
to puppet...@googlegroups.com
You could create a parameter called `$manage_audispatch = false` and in hiera, set `profile::whatever::manage_audispatch: true` in hiera for qualified devices (probably osfamily of RedHat, os/release/major of 6). Your code conditional is very simple (`if $manage_audispatch { .. }`), abstract out the complexity with hiera.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAJdJdQ%3D-TEf_Dz0ec8vG8MwYpnr44SBCnVubhS%3DWBJ8N75TeqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

warron.french

unread,
Mar 30, 2017, 11:01:59 AM3/30/17
to puppet...@googlegroups.com
Hi Rob, I am not quite (personally/professionally) ready for Hiera yet.  I also need to learn more about ERB templates; which I did a little research on about 2 hours ago.

Honestly, what you provided above to me, because I am not ready/fully understanding yet, has no context for me to implement your idea.  Which, if I did, I would gracefully accept your input and get it done.  :-/

Thanks for this suggestion.  I simply am not there yet.

Sincerely, thank you.

--------------------------
Warron French


Rob Nelson

unread,
Mar 30, 2017, 5:20:56 PM3/30/17
to puppet...@googlegroups.com
Warron,

Hiera is a lot easier than it seems! If you join the puppet slack (https://slack.puppet.com), I'm sure we could help you get it set up quickly and properly. It will probably solve a dozen other problems you didn't even know you had, too :)

warron.french

unread,
Mar 31, 2017, 8:17:38 AM3/31/17
to puppet...@googlegroups.com
LOL!  Cool!  I will join then.

--------------------------
Warron French


Reply all
Reply to author
Forward
0 new messages