group模块
group模块作用
group模块可以帮助我们管理远程主机上的组
group模块参数
name参数:必须参数,用于指定要操作的组名称。
state参数:用于指定组的状态,两个值可选,present、absent;默认为present,设置为absent表示删除组。
gid参数:用于指定组的gid
创建组:(name)
[root@server1 testdir]# ansible testB -m group -a “name=pyy”
删除组(state)
[root@server1 testdir]# ansible testB -m group -a "name=pyy state=absent"
注意当组被用户使用的时候,只能删除附加组,不能删除主组。
起初:
结果:
(gid参数)
[root@server1 testdir]# ansible testB -m group -a "name=ddd gid=66666"
更换已知组的gid
[root@server1 testdir]# ansible testB -m group -a "name=ddd gid=888"