参数
参数 | 选项/默认值 | 描述 |
gid interger | | 要为组设置的可选 GID。 |
local boolean |
| 强制在实现它的平台上使用“local”命令替代项。 这在要操作本地组时使用集中式身份验证的环境中非常有用。(例如,它使用 代替lgroup addgroupadd )。 |
name string required | | 要管理的组的名称。 |
non_unique boolean |
| 此选项允许将组 ID 更改为非唯一值。需要gid 在苹果操作系统或BusyBox上不受支持。 |
state string |
| 该组是否应存在于远程主机上. |
system boolean |
| 如果是,则表示创建的组是系统组 |
示例
- name: Ensure group "somegroup" exists
ansible.builtin.group:
name: somegroup
state: present
- name: Ensure group "docker" exists with correct gid
ansible.builtin.group:
name: docker
state: present
gid: 1750
参考文档
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/group_module.html#group-module