Many thanks John. Now it is solved.

Here is the solution.

init.pp
class admin_user::group {
   group { "baaderadm":
      gid => "888",
      ensure => present,
   }
}

class admin_user {
   include admin_user::group, admin_user::list
}

list.pp
class admin_user::list {
   admin_user::useradd { "user1":
      comment => "user1",
      uid => "1032",
      gid => "888",
      group => "baaderadm",
      shell => "/bin/bash",
      password => '$6$QMhC7iyQ$CeUQnyZR1/jkH61SaE7gz/',
      sshkeytype => "rsa",
      sshkey => 
"AAAAB3NzaC1yc2EAAAABIwAAAIEAs+EjM0/U4rGLe5OipRtqkwkfk93KX/i6N8=",
   }
 admin_user::useradd { "user2":
      comment => "user2",
      uid => "1033",
      gid => "888",
      group => "baaderadm",
      shell => "/bin/bash",
      password => '$6$QMhC7iyQ$CeUQnyZR1/jkH61SaE7gz/',
      sshkeytype => "rsa",
      sshkey => 
"AAAAB3NzaC1yc2EAAAABIwAAAIEAs+EjM0/U4rGLe5OipRtqkwkfk93KX/i6N8=",
   }
}

useradd.pp
define admin_user::useradd ( $comment, $uid, $group, $gid, $password, 
$shell, $sshkeytype, $sshkey) {
   include admin_user::group
   $username = $title

   user { $username:
      ensure => present,
      comment => "$comment",
      uid => "$uid",
      gid => "$gid",
      shell => "$shell",
      home => "/home/$username",
      managehome => true,
      forcelocal => true,
      password => "$password",
      require => Group["baaderadm"],
   }

   ssh_authorized_key { $username:
      user => "$username",
      type => "$sshkeytype",
      key => "$sshkey",
      require => User["$username"],
   }
}


-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to