Hi @all,

I write a module that create local users on my boxes. Now I try to make
that module fully dynamic so that the user informations are passed to the
module as parameter like this:

class { 'local_users':
  user => [
    { 'john' => { name => 'John Doe', home => '/export/home/john' } },
    { 'jane' => { name => 'Jane Doe', home => '/export/home/jane' } }
  ]
}

So far, so good. But now I would like to iterate through the user array and
create the user resource and I have no clue how this should be done
correctly. My approach is to call a define:

local_users::config::account { $local_users::user }

Which look like this:

define local_users::config::account (
  $id   = $title,
  $name = undef,
  $home = undef
) {
  user { $id:
    ensure     => present,
      comment    => $name,
      home       => $home,
      managehome => true,
      password   => '!!';
  }
}

I guess the direction should be understandable, I would like to specify the
users and their attributes as a parameter. What I don't get so far is, do I
need one resource definition for each possible combination or is there a
way that only the parameter that contain values are used within the
resource type? Is the path in general the correct one that I use or is
there a better approach to get this done?

​Regards Thomas​
-- 
Linux ... enjoy the ride!

-- 
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/CAELoU1NfDYgjqgHsH%3DAGmOsM9GG1nuAfnRibc_fA9cRUe5uMug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to