How to delete users from groups ?

241 views
Skip to first unread message

eduardo

unread,
Jul 22, 2012, 7:13:19 PM7/22/12
to Puppet Users
Dears all,

I'm trying update user's membership group deleting users from some
groups.
To do it i took exec way doing :

exec { "deluser ${username} ${group}":

I'm thinking might be there is more elegant solution without using
exec type .

Is there another way to do it ?.

Thanks in advanced.
eduardo.

Paul Tötterman

unread,
Jul 23, 2012, 2:05:01 AM7/23/12
to puppet...@googlegroups.com
Hi eduardo,
 
  Is there another way to do it ?.

user { "$username":
  ensure => present,
  key_membership => inclusive,
  groups => ['all', 'groups', 'except', '$group'], # full listing of all groups $username belongs to
}

or

group { "$group",
  ensure => present,
  attribute_membership => inclusive,
  members => ['all', 'members', 'except', '$username'], # full listing of all members of $group
}

Cheers,
Paul

eduardo

unread,
Jul 23, 2012, 8:27:22 AM7/23/12
to Puppet Users
Hi Paul, thanks you for your suggestion.

I wrote key_membership => inclusive in user type, but the groups were
not updated.

Having user's membership into array variable $groups i did :


user { $username:
...
key_membership => inclusive,
groups => [$groups]
}

am i missing something ?

I have puppet version 2.7.1.


Regards,
eduardo.

eduardo

unread,
Jul 23, 2012, 8:59:10 AM7/23/12
to Puppet Users
Hi Paul, I found note in http://projects.puppetlabs.com/issues/7241.
So I can do it using membership => inclusive (instead of
key_membership)

I appreciate your help.

Regards,
eduardo.

On 23 jul, 02:05, Paul Tötterman <paul.totter...@gmail.com> wrote:

Paul Tötterman

unread,
Jul 24, 2012, 6:40:58 AM7/24/12
to puppet...@googlegroups.com
So I can do it using membership => inclusive (instead of
key_membership)

You're right, I took a too quick look at http://docs.puppetlabs.com/references/latest/type.html

Cheers,
Paul 
Reply all
Reply to author
Forward
0 new messages