I am moving from Puppet 0.25 to Puppet 4.  In doing so I am re-writing a 
lot of the modules to work better than what I inherited. 

So my current issue I am trying to figure out is how to update PAM 
variables based on what external 3rd party authentication package we have 
installed on that server. The old method that had been employed was to use 
an exec to push a file with the correct settings.  I am trying to do it via 
a template. 

The problem I am having is that I need to check if the PAM module is 
installed before making the changes and revert them if it is removed. I 
know I can write a custom fact, but on the 0.25 version a custom fact 
required both puppet.conf edits and a bounce of the agent. I haven't tried 
on the later versions, but I remain gun shy, 

Ideally I would run an execute to check the module and only do the changes 
if the PAM module is in place. I haven't figured out how to do that yet 
with templates. 

Has anyone else figured out the least invasive way to do this. Aka no 
custom facts?

Do I need to just knuckle down and learn enough Ruby to have it determine 
if the package is set and use one variable, if not the other? 

I am still new to Puppet coding in Puppet 4, well in general too, when 
getting into the weeds like this. I would assume there is a simple think 
like below. (Notes this is probably not correct puppet code, just a 
pseudocode example) 
     
    if ( ! exec { check_package: 
          path => "/usr/bin:/bin:/sbin:/usr/sbin",   
          command => "rpm -q <package>",
          } ) { 
         $extra_lines = [ 
         'blah blak', 
         'blah',
         ]
       }

Think is I just don't have enough skill yet to make it work on my own yet, 
so I am reaching out to see if someone already figured this out as I keep 
hammering on it. 

Thanks! 
             

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fd5cb2f3-8ab1-4c0e-8134-f8e5ec49c1ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to