Justin
2011-May-25 20:46 UTC
[Puppet Users] Managing netgroups in /etc/passwd with Puppet via Augeas
Hi all, I''m relatively new to both Puppet and Augeas. I''m currently stuck trying to figure out how to manage hosts'' netgroup entries in /etc/ passwd. I''ve got it working to ensure a single specified netgroup is the only one in /etc/passwd: class ldap { define netgroups { augeas { "netgroups": context => "/files/etc/passwd", changes => [ "rm @nis", "set @nis[1] $name", ], } } } In my nodes.pp: node host1 { ldap::netgroups { "admins": } } I''d like to generalize this so I can list multiple netgroups, e.g.: node host1 { ldap::netgroups { "admins dbas devs": } } I''ve been hunting around looking for similar concepts and I''ve come somewhat close using split() with a variable recipe name, e.g.: class ldap { $netgroups = split($name, " ") $context = "/files/etc/passwd" augeas { "cleanup-netgroups": context => $context, changes => "rm @nis", } augeas { $netgroups: context => $context, changes => [ "set @nis[last()+1] $name", ], } } though I''m running into an ordering problem here. Am I even on the right path here or is there a better approach to this sort of problem? Thanks, Justin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Justin
2011-May-25 23:04 UTC
[Puppet Users] Re: Managing netgroups in /etc/passwd with Puppet via Augeas
Hmm, I think I may have found a more tractable approach in the template() and inline_template() functions. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.