If you change "gid => $gid" to "gid => $title" then you don't need any of
the require meta parameters in your user, group or file resource
declarations, they can be removed.

There is implied dependency between the gid of a user and the title of a
group, and between owners/groups of files and their respective user/group
resources.

Craig



On Mon, Mar 3, 2014 at 10:33 PM, Race Boyer <[email protected]> wrote:

> Hello everyone,
>
> I am trying virtualize my users and that works out just fine, but the
> problem is I have some aix users that need a particular group. So I thought
> it would be a good idea to add a conditional to the virtual resource, but I
> get stuck with this error:
>
> err: Failed to apply catalog: Could not find dependency Group[9231] for
> User[race] at
> /etc/puppet/environments/development/modules/admin2/manifests/virtual.pp:17
>
> what I think is happening is that for some reason my group is not being
> realized (if that's the proper term?) so the manifest is failing. here is
> the virtual manifest:
>
> # define type for creating virtual user accounts
> define admin2::virtual ($uid,$gid,$realname,$pass,$sshkey="") {
>
>
> user { $title:
>   ensure     => 'present',
>   uid        => $uid,
>   gid        => $gid,
>   shell      => '/bin/bash',
>   home       => "/home/${title}",
>   comment    => $realname,
>   password   => $pass,
>   managehome => true,
>   require    => Group[$gid],
> }
>
> group { $title:
>   gid => $uid,
> }
>
> file { "/home/${title}":
>   ensure  => directory,
>   owner   => $title,
>   group   => $gid,
>   mode    => '0750',
>   require => [ User[$title], Group[$gid] ],
> }
>
> if ( $sshkey != "" ) {
>  ssh_authorized_key { $title:
>   ensure => 'present',
>   type => "ssh-rsa",
>   key => "$sshkey",
>   user => "$title",
>   require => User ["$title"],
>   name => "$title"
> }
> }
> }
>
> and here is the init.pp
> class admin2 {
>
> $gid = $::operatingsystem ? {
>    'AIX'      => '1100',
>    default    => $gid,
>    }
>
>
> @admin2::virtual { 'race':
>   uid      => '9231',
>   gid      => '9231',
>   realname => 'Race Boyer',
>   pass     => 'pass',
>   sshkey => 'sshkey'
> }
>
> @admin2::virtual { 'dss':
>   uid      => '506',
>   gid      => '506',
>   realname => 'The DSS team',
>   pass     => 'pass',
> }
>
> }
>
> i started with the virtual lesson from Craig Dunn's 
> blog<http://www.craigdunn.org/2011/03/puppet-working-with-define-based-virtuals/>if
>  anyone can tell me what I did wrong, it would be greatly appreciated.
>
> --
> 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/da0359c9-9d9a-40a4-8ccb-cd622019f5e4%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
*Enviatics *| Automation and configuration management
http://www.enviatics.com | @Enviatics
Puppet Training http://www.enviatics.com/training/

-- 
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/CACxdKhE-CsD2vgafSuRyQoEX7a83FiL%2BKfsTeAwEiBJDhdoagQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to