advice change user group aix

18 views
Skip to first unread message

hop

unread,
Apr 1, 2014, 9:43:14 AM4/1/14
to puppet...@googlegroups.com
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.

thx.

jcbollinger

unread,
Apr 2, 2014, 9:37:26 AM4/2/14
to puppet...@googlegroups.com


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

Reply all
Reply to author
Forward
0 new messages