On Fri, Apr 29, 2011 at 9:53 AM, takrishnan <takrish...@yahoo.com> wrote:
> I would like add multiple sudoer files to the sudoers.d directory and
> would like someone to help.
>
> I'm thinking something like should work but it's no.
>
> init.pp
> ---------
> class sudoers {
>       file:
>        :
>        :
>       pkg:
>        :
>        :
> }
>
> class sudoers::$sudogroup {
>        file {"$dirpath/$sudogroup":
>                path => "$dirpath/$sudogroup",
>                source => "puppet:///modules/sudoers/sudoers.d/
> $sudogroup",
>                require => "File[/etc/sudoers.d]";
>        }
> }

What you are looking for is a define resource instead of a class.

define sudoers::config {
  file { "/path/to/sudoers.d/${name}:
    source => "puppet:///modules/sudoers/sudoers.d/${name}",
  }
}

The require File[/etc/sudoers.d] should not be necessary, since it's
an implied dependency (puppet knows it's a file under that directory,
and you can find all implied dependency using --graph). You can use
the define like it's any standard resource:

sudoers::config { "group1": }
sudoers::config { "group2": }
...

Thanks,

Nan

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to