salt.modules.groupadd

Manage groups on Linux, OpenBSD and NetBSD

Important

If you feel that Salt should be using this module to manage groups on a minion, and it is using a different module (or gives an error similar to 'group.info' is not available), see here.

salt.modules.groupadd.add(name, gid=None, system=False, root=None)

Add the specified group

name

Name of the new group

gid

Use GID for the new group

system

Create a system account

root

Directory to chroot into

CLI Example:

salt '*' group.add foo 3456

salt.modules.groupadd.adduser(name, username, root=None)

Add a user in the group.

name

Name of the group to modify

username

Username to add to the group

root

Directory to chroot into

CLI Example:

salt '*' group.adduser foo bar

Verifies if a valid username 'bar' as a member of an existing group 'foo', if not then adds it.

salt.modules.groupadd.chgid(name, gid, root=None)

Change the gid for a named group

name

Name of the group to modify

gid

Change the group ID to GID

root

Directory to chroot into

CLI Example:

salt '*' group.chgid foo 4376

salt.modules.groupadd.delete(name, root=None)

Remove the named group

name

Name group to delete

root

Directory to chroot into

CLI Example:

salt '*' group.delete foo

salt.modules.groupadd.deluser(name, username, root=None)

Remove a user from the group.

name

Name of the group to modify

username

Username to delete from the group

root

Directory to chroot into

CLI Example:

salt '*' group.deluser foo bar

Removes a member user 'bar' from a group 'foo'. If group is not present then returns True.

salt.modules.groupadd.getent(refresh=False, root=None)

Return info on all groups

refresh

Force a refresh of group information

root

Directory to chroot into

CLI Example:

salt '*' group.getent

salt.modules.groupadd.info(name, root=None)

Return information about a group

name

Name of the group

root

Directory to chroot into

CLI Example:

salt '*' group.info foo

salt.modules.groupadd.members(name, members_list, root=None)

Replaces members of the group with a provided list.

name

Name of the group to modify

members_list

Username list to set into the group

root

Directory to chroot into

CLI Example:

salt '*' group.members foo 'user1,user2,user3,...'
Replaces a membership list for a local group 'foo'.

foo:x:1234:user1,user2,user3,...

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.groupadd.html