ansible 之 group

group

用途:管理主机中的用户组,Windows 中使用 win_group 模块

官方文档

[root@ansible ~]# ansible-doc group
> GROUP    (/usr/lib/python2.7/site-packages/ansible-2.8.0.dev0-py2.7.egg/ansible/modules/system/group.py)

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

  * This module is maintained by The Ansible Core Team
OPTIONS (= is mandatory):

- gid
        Optional `GID' to set for the group.
        [Default: (null)]

- local
        Forces the use of "local" command alternatives on platforms that implement it.
        This is useful in environments that use centralized authentication 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.
        [Default: no]
        type: bool
        version_added: 2.6

= name
        Name of the group to manage.


- state
        Whether the group should be present or not on the remote host.
        (Choices: absent, present)[Default: present]

- system
        If `yes', indicates that the group created is a system group.
        [Default: no]
        type: bool


NOTES:
      * For Windows targets, use the [win_group] module instead.

REQUIREMENTS:  groupadd, groupdel, groupmod

AUTHOR: Stephen Fromm (@sfromm)
        METADATA:
          status:
          - stableinterface
          supported_by: core
        

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

参数解释

  • gid
    默认值:null
    设置组

  • local

= name
管理的组名字

  • state
    默认值:present
    在远程主机上用户组是否被更改或删除
    选项:absentpresent

  • system
    默认值:no
    类型:bool
    如果设置为 yes,则被创建的组名为一个系统组

posted @ 2018-12-06 14:26  McSiberiaWolf  阅读(462)  评论(0编辑  收藏  举报