community.openwrt.group module – Add or remove groups

Note

This module is part of the community.openwrt collection (version 1.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.openwrt.

To use it in a playbook, specify: community.openwrt.group.

New in community.openwrt 1.2.0

Synopsis

  • Manage presence of groups on a host.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

force

boolean

Whether to delete a group even if it is the primary group of a user.

Choices:

  • false ← (default)

  • true

gid

integer

Optional GID to set for the group.

gid_max

integer

Sets the GID_MAX value for group creation.

gid_min

integer

Sets the GID_MIN value for group creation.

name

string / required

Name of the group to manage.

non_unique

boolean

This option allows to change the group ID to a non-unique value. Requires gid.

Choices:

  • false ← (default)

  • true

state

string

Whether the group should be present or not on the remote host.

Choices:

  • "absent"

  • "present" ← (default)

system

boolean

If true, indicates that the group created is a system group.

Choices:

  • false ← (default)

  • true

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Returns details on what has changed (or possibly needs changing in check_mode), when in diff mode.

platform

Platform: OpenWrt

Target platform for this module.

Examples

- name: Ensure group "somegroup" exists
  community.openwrt.group:
    name: somegroup
    state: present

- name: Ensure group "docker" exists with correct gid
  community.openwrt.group:
    name: docker
    state: present
    gid: 1750

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

gid

integer

Group ID of the group.

Returned: When state=present

Sample: 1001

name

string

Group name.

Returned: always

Sample: "users"

state

string

Whether the group is present or not.

Returned: always

Sample: "absent"

system

boolean

Whether the group is a system group or not.

Returned: When state=present

Sample: false

Authors

  • Sebastian Hamann (@s-hamann)