ansible常用模块之 -- group模块 – 添加或删除组
group模块 – 添加或删除组
一、摘要
- 管理主机上的组是否存在。
- 对于Windows目标,请使用win_group模块。
二、参数
参数 | 选项/默认值 | 描述 |
---|---|---|
gid interger | 要为组设置的可选 GID。 | |
local boolean | · no ← · yes | 强制在实现它的平台上使用“local”命令替代项。 这在要操作本地组时使用集中式身份验证的环境中非常有用。(例如,它使用 代替lgroup addgroupadd )。 |
name string required | 要管理的组的名称。 | |
non_unique boolean | · no ← · yes | 此选项允许将组 ID 更改为非唯一值。需要gid 在苹果操作系统或BusyBox上不受支持。 |
state string | · present ← · absent | 该组是否应存在于远程主机上. |
system boolean | · no ← · yes | 如果yes,则表示创建的组是系统组 |
三、示例
# 确保 somegroup 组存在
- name: Ensure group "somegroup" exists
group:
name: somegroup
state: present
官方文档:https://docs.ansible.com/ansible/2.9/modules/group_module.html#group-module