Not sure how to do it, but what I would try: (see inline)

On 18.06.2010 13:46, daniel wrote:
    Hey, guys! These days I'm keep on setting up my puppet automation
environment, but I got a problem that made me confused.
I have a define to add users ,which as follows :

define usermgr::add_user ($usershell='/bin/bash', $groups) {
   4
   5     file
   6     {   "/home/$title":
   7         owner   =>  "$title",
   8         group   =>  "$title",
   9         mode    =>  755,
  10         ensure  =>  directory;
  11     }
  12
  13     user {
  14         "$title":
  15         shell =>  "$usershell",
  16         groups =>  ["$groups"],
Try changing this to groups => $groups
  17         ensure =>  present,
  18         home  =>  "/home/$title",
  19     }
20
  21
  22     file
  23     {   "/home/$title/.ssh":
  24         owner   =>  "$title",
  25         group   =>  "$title",
  26         mode    =>  700,
  27         ensure  =>  directory,
  28         require =>  File["/home/$title"];
  29     }

then i want to pass some parameters to this define to add user tester
who belongs to group root and adm:
class usermgr::project1 {
   6     usermgr::add_user {
   7         "tester":
   8             usershell =>  "/bin/bash",
   9             groups =>  ['root','adm']
  10    }
  11 }

but it always failed as follows:
err: //usermgr::project1/Usermgr::Add_user[tester]/User[flex1]/groups:
change from tester to tester,rootadm failed: Could not set groups on
user[tester]: Execution of '/usr/sbin/usermod -G tester,rootadm
tester' returned 6: usermod: group 'rootadm' does not exist

   the information seems like that the groups parameter is parsed
wrong , does anyone have idea to parse this array parameter right ?

Thanks so much:>



Silviu

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to