puppet-sudo icon indicating copy to clipboard operation
puppet-sudo copied to clipboard

Add support for epp templates

Open patemery opened this issue 1 year ago • 4 comments

Add the capability to use epp templates in hiera data to create sudoers.d files. There are two solutions for this. If the epp template is a simple template, then it can simply be used with the template meta-parameter without any other changes as in the following example.

sudo::configs:
    'os_admins':
        'template': "mytemplates/osadmins.epp"
    'dba_admins':
        'template': "mytemplates/dbaadmins.erb"

If the epp template is more complex and requires input parameters, there is a new meta-parameter template_epp. This meta-parameter requires two input parameters; filename (string) and params (hash). There are examples of this given in the README.

Additionally, I've added two new epp templates that allow for some more elaborate sudoers.d allocations.

patemery avatar Mar 30 '24 02:03 patemery

@patemery Please rebase this MR, fix issues and squash commits

saz avatar May 13 '24 15:05 saz

Wow. I don't have a lot of git experience. It took me about 3 hours to get this all cleaned up. I think I have it the way you wanted it. Thank you so much for considering my enhancement. Let me know if I am still missing anything

patemery avatar May 14 '24 01:05 patemery

@patemery I've just merged a PR, which adds data types to all parameters in sudo::conf. It would be great to rebase your branch against the master branch of this module

saz avatar May 14 '24 08:05 saz

@saz I merged all of your latest commits and tried your latest type suggestion. It worked great. Thank you for that. I would have never come up with that.

I looked at the existing tests. I'm sad to admit I've never written any rspec tests. I think I can create a few following the existing code as examples. Can you tell me how to execute the tests on my local system? I downloaded and installed pdk and I tried doing pdk test unit and got the error This module is not PDK compatible.

patemery avatar May 15 '24 01:05 patemery