On Tuesday, October 29, 2013 10:31:56 AM UTC-5, [email protected] wrote:
>
> I see that makes sense, would you be able to give a quick example of the
> required syntax?
>
>
Here is a simple example. If you have more than a tiny number of users
and/or groups, however, or if they change with any frequency, then you
should probably externalize your data instead encoding it directly in your
classes. Externalizing your data is a whole other kettle of fish, though.
<module path>/accounts/manifests/groups.pp:
----
class accounts::groups {
@group { 'testgroup': ensure => present }
@group { 'testgroup2': ensure => present }
}
<module path>/accounts/manifests/virtual.pp:
----
# note the file name --
# NOT accounts.pp as in the orginal post
define accounts::virtual ($realname,$pass,$gid,$sshkey="") {
include accounts::groups
realize Group[$gid]
user { $title:
ensure => present,
gid => $gid,
# ...
}
# Note: User autorequires Group[$gid] if it is Puppet-managed,
# so there's no need to declare that explicitly.
# ...
}
John
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/a67c8e99-4b47-486e-bfa1-7443db42a13a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.