Hello all,

I was reviewing some of my company's Puppet manifests that we use when 
deploying certain server types. In one of them we were calling a lot of 
user and group resources, which I found repetitive, so I just grouped all 
the users and groups into their own hashes, then I just ran an each 
function on both hashes. My issues comes in where I want to explicitly call 
my dependency. The users I'm creating are being set with GID's I'm also 
creating, so I want to make sure that the groups are created first. 
However, because I'm specifying my user and group resources inside an each 
lambda and using a variable as my namevar I can't call out the resource. 
Here is the code I have in the manifest:

# Add host automation groups.
$groups.each |$group, $groupdetail| {
        group { $group:
                *       => $groupdetail,
        }
}


# Add host automation users.
$users.each |$user, $userdetail| {
        user { $user:
                *       => $userdetail,
        }
}

As you can see I can't put a "before => User['resource_name']" in the group 
resource, because each user resource is dynamic. What is the recommended 
approach in this situation? I just want to make sure that all the groups 
are created before the users are created.

Thanks,
Joshua Schaeffer

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/78fa8a60-be0c-4b16-9b31-1702ec7089b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to