removing group from user (creted using hiera common.yaml)

asked 2018-02-15 13:19:48 -0500

David gravatar image

i create a user in hiera and assign groups, how do i remove 1 of the groups defined:- accounts::users: blogsj: comment: "joe bloggs" uid: '30001' gid: '30001' sshkeys: - "a key" purge_sshkeys: true groups: - developers - install i want to get rid of membership to just 1 group...

edit retag flag offensive close merge delete

Comments

1

You can manage group membership with the user function: https://puppet.com/docs/puppet/4.6/type.html#user-attribute-groups If all else fails and you don't want to code it, you can just make an exec function with the linux command to remove a user from a group

Hypnoz gravatar imageHypnoz ( 2018-02-16 03:20:12 -0500 )edit

Hi, Thanks, but i create multiple groups fine. removing the group from the list will not remove it. i could delete the user and re-create it, but would love to know if there is a better way?

David gravatar imageDavid ( 2018-02-19 09:01:17 -0500 )edit

I added an EXEC to remove the group - EXEC {'remove_user_from_group': command => 'gpasswd -d {USER} {GROUP}', path => '/usr/bin', } I just hoped that there was a way of deleting a user from a group that was created using puppet as the member of an array of groups...

David gravatar imageDavid ( 2018-02-22 07:52:23 -0500 )edit