saz / puppet-sudo

Manage sudo with Puppet on Debian-, RedHat- and SUSE-based linux distributions and some BSDs
Other
105 stars 215 forks source link

Can add_users or similar way, using hiera sudo::configs, but for different templates than sudo ALL? #150

Closed brahama closed 7 years ago

brahama commented 8 years ago

Hi,

Couldn find a Subject for this. Sorry.

What i am trying to do , is to add users, groups from hiera to a template other than the users_groups.erb as that template grants ALL.

I ws thinking in having a template for a subset of commands permited defined already as Alias in sudoers (this is done)

<% @users.each do |user| -%> <%= user %> ALL=(ALL) WEBADMINS <% end -%> <% @groups.each do |group| -%> %<%= group %> ALL=(ALL) WEBADMINS

This is in order to avoid duplicating info in hiera for lets say i have to give two persons a sudo for:

"sudo::configs" : { "sudo_web" : { "content" : "username1 ALL=(ALL) WEBADMIN", "priority" : 50 }, "sudo_web2" : { "content" : "username2 ALL=(ALL) WEBADMIN", "priority" : 50 } },

I hope its clear the doubt. I dont know if now, this can be done without creating files per user, i mean creating each block in hiera per user. If this can be done in an add_user/group like manner, then i dont know how. If not, perhaps its a desired feature? Then i could help with the code. Thanks!

saz commented 7 years ago

Use sudo::configs and set configs_hash to the right values (it's creating sudo::conf resources)