Re: [Puppet Users] Adding existing users to groups

2011-03-24 Thread Felix Frank
Hi,

On 03/23/2011 07:13 PM, Peter Gillard-Moss wrote:
 Hi,
 
 I have an interesting problem with groups and users.
 
 Our puppet configuration is nice and modular so each application we wish
 to install has its own class.  For some applications we want to add
 existing users, created in another class to a new group.  Here's an example:
 
 class App1 {
   package { App1 ... }
   user { app1user : ... }
 }
 
 class App2 {
   package { app2
 requires = Package[app1] 
   }
   group { app2users :
 ensure = present
   }
   user { name = app1user
 groups = app2users
   }
 }

In class App2, do
User| title == app1user | { groups = [ app2users ] }

Plusignment may work even better for you
User| title == app1user | { groups + [ app2users ] }

 However puppet seems to balk doing this (even the first app) with:
   Cannot alias User[app1inapp3] to app1user; resource User[app1user]
 already exist
 
 Just to add some extra complexity we also need to have two apps that
 extend the first one, like so:
 
 class App3 {
   package { app3
 requires = Package[app1] 
   }
   group { app3users :
 ensure = present
   }
   user { app1inapp3 name = app1user
 groups = app3users
   }
 }

It's not at all clear to me what this is supposed to do. Perhaps you want to
class App3 {
  include App1::with_app3_support
}

and

class App3::with_app3_support inherits App3 {
  User[app1user] { groups + [ app3users ] }
}

BTW, does this manifest even work? I believe uppercasing class names
breaks puppet. (But you're probably just over-paraphrasing?)

HTH,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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.



Re: [Puppet Users] Adding existing users to groups

2011-03-24 Thread Felix Frank
 It's not at all clear to me what this is supposed to do. Perhaps you want to
 class App3 {
   include App1::with_app3_support
 }
 
 and
 
 class App3::with_app3_support inherits App3 {
   User[app1user] { groups + [ app3users ] }
 }

Grr. That's what you get for over-paraphrasing ;-p

Of course, that should be App1::with_app3_support inherits App1. Silly me.

Regards,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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.



[Puppet Users] Adding existing users to groups

2011-03-23 Thread Peter Gillard-Moss
Hi,

I have an interesting problem with groups and users.

Our puppet configuration is nice and modular so each application we wish to 
install has its own class.  For some applications we want to add existing 
users, created in another class to a new group.  Here's an example:

class App1 {
  package { App1 ... }
  user { app1user : ... }
}

class App2 {
  package { app2
requires = Package[app1]  
  }
  group { app2users :
ensure = present
  }
  user { name = app1user
groups = app2users
  }
}

However puppet seems to balk doing this (even the first app) with:
  Cannot alias User[app1inapp3] to app1user; resource User[app1user] 
already exist

Just to add some extra complexity we also need to have two apps that extend 
the first one, like so:

class App3 {
  package { app3
requires = Package[app1]  
  }
  group { app3users :
ensure = present
  }
  user { app1inapp3 name = app1user
groups = app3users
  }
}

To get around this we have dumped everything in the app1user definition but 
this isn't very modular as machines that have no App2 or App3 end up with 
their user groups everywhere.

Is there an alternative approach that I'm missing?

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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.