On Tuesday, April 1, 2014 8:43:14 AM UTC-5, hop wrote:
>
> Hello.
> I wantaed to ask, if is a better way to change user groups then this:
>
> exec {"process $usr":
>                 command =>"chgrp ..... $newGroup",
>                 path    =>[ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ]
>         }
>
> I need to make the user move and he was only in the new group.
>
>

You will benefit from adjusting your thinking to Puppet's model. In 
particular, Puppet's DSL is not a scripting language, so you generally want 
to avoid thinking in terms of what you want *Puppet* to *do*.  Instead, 
your objective in Puppet DSL is to model the state you want *the target 
machine* to *be* in.

With that said, yes, there is probably a better way.  Puppet provides the 
User resource type with which to model system users and their properties.  
To model (only) the requirement that the specified user has the specified 
group as his primary group, you could write this:

user { $usr:
  group => $newGroup
}

There is much more to say on the subject, but the Puppet documentation is a 
better way to start.  In particular, I advise you to read through the 
language reference (chapter "The Puppet Language" at 
http://docs.puppetlabs.com/puppet/3.5/reference/), and to at least skim the 
list of built-in resource types and functions (
http://docs.puppetlabs.com/references/3.5.latest/type.html and 
http://docs.puppetlabs.com/references/3.5.latest/function.html).


John

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a604f4bc-63e1-4e9d-aca2-1b5ebdb2848f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to