group - Add or remove groups

Synopsis

  • Manage presence of groups on a host.
  • For Windows targets, use the win_group module instead.

Requirements

The below requirements are needed on the host that executes this module.

  • groupadd
  • groupdel
  • groupmod

Parameters

Parameter Choices/Defaults Comments
gid
Optional GID to set for the group.
local
(added in 2.6)
Default:
"no"
Forces the use of "local" command alternatives on platforms that implement it. This is useful in environments that use centralized authentification when you want to manipulate the local groups. I.E. it uses `lgroupadd` instead of `useradd`.
This requires that these commands exist on the targeted host, otherwise it will be a fatal error.
name
required
Name of the group to manage.
state
    Choices:
  • absent
  • present
Whether the group should be present or not on the remote host.
system
bool
    Choices:
  • no
  • yes
If yes, indicates that the group created is a system group.

Notes

Note

  • For Windows targets, use the win_group module instead.

Examples

- name: Ensure group "somegroup" exists
  group:
    name: somegroup
    state: present

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

Maintenance

This module is flagged as core which means that it is maintained by the Ansible Core Team. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Core Team, see here.

Support

For more information about Red Hat’s support of this module, please refer to this Knowledge Base article

Author

  • Stephen Fromm (@sfromm)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/group_module.html