Have a look at virtual resources.  When needed, you can realize them.
The puppet cookbook has a chapter explaining this

On 10/08/2013 01:15 PM, Andreas Dvorak wrote:
Dear all

I am looking for a solution for a module to define alle possible user and then install the one or more user from that module if needed on a server, but not all of them. My idea is something like this. Can I define a user in the nodes.pp at a special Server to install that user?

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

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

list.pp with many user like this

class admin_user::list {
   admin_user::useradd { "test1":
      comment => "test1",
      uid => "1032",
      gid => "888",
      shell => "/bin/bash",
      password => '$6$QMhC7iyQ$CeUQnyZRaqzUp1/jkH61SaE7gz/',
      sshkeytype => "rsa",
sshkey => "AAAAB3NzaC1yc2EAAAABIwAAA4gZcD7cxU7Yu2Gs4iL5bycu1nSb0/U4rGLe5OipRtqkwkfk93KX/i6N8=",
   }

   admin_user::useradd { "test2":
      comment => "test2",
      uid => "2012",
      gid => "888",
      shell => "/bin/bash",
      password => '$6$0vY.Ob.b$uF0JMxjptxEq9gj72KrU7CqB7ez0gCt6fAB1',
      sshkeytype => "rsa",
sshkey => "AAAAB3NzaC1yc2EAA/QtjZcPsaAhdZMsNU9xJ0Hb1VX3+vaAX1pA4F1Lq87ZBrZxrTS2F0G7hHJDffhqwlYoWfl1755hWeNeNZWQBcF"
   }
}

and 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"],
   }
}

nodes.pp

node 'vm6742.muc.baag' inherits base {
   $user = "test1"
   include jre17_32bit
}

Maybe I need to split the list.pp in separate files for every user, but I do not know how to request a specific user.
Maybe something like that: include addmin_user::test1

I could create a modul for every user and add it to a server, but I think that is not a good solution.

Best regards
Andreas

--
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.


--
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer         (805008667232363)
Puppet Certified Professional 2013 (PCP0000006)
_________________________________________________________
Open-Future Phone +32 (0)2/255 70 70
Zavelstraat 72              Fax       +32 (0)2/255 70 71
3071 KORTENBERG             Mobile    +32 (0)474/42 40 73
BELGIUM                     http://www.open-future.be
_________________________________________________________

Next Events:
Extending Puppet Training 2013 | 
http://www.open-future.be/extending-puppet-training-8-till-11th-october
Puppet Fundamentals Training | 
http://www.open-future.be/puppet-fundamentals-training-15-till-17th-october
Puppet Advanced Training | 
https://www.open-future.be/puppet-advanced-training-12-till-14th-november
Zabbix Certified Training | 
http://www.open-future.be/zabbix-certified-training-18-till-20th-november
Zabbix Large Environments Training | 
http://www.open-future.be/zabbix-large-environments-training-21-till-22nd-november
Puppet Fundamentals Training | 
http://www.open-future.be/puppet-fundamentals-training-10-till-12th-december
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
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