ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[admin@node1 ansible]$ ansible-doc -s group - name: Add or remove groups group: gid: # Optional `GID' to set for the group. name: # (required) Name of the group to manage. state: # Whether the group should be present or not on the remote host. system: # If `yes', indicates that the group created is a system group. 案例: ~~~ [admin@node1 ansible]$ ansible webserver -m group -a "name=hagroup gid=1052 state=present" -b --ask-sudo-pass [DEPRECATION WARNING]: The sudo command line option has been deprecated in favor of the "become" command line arguments. This feature will be removed in version 2.6. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. SUDO password: 192.168.20.131 | SUCCESS => { "changed": true, "gid": 1052, "name": "hagroup", "state": "present", "system": false } 192.168.20.132 | SUCCESS => { "changed": true, "gid": 1052, "name": "hagroup", "state": "present", "system": false } ~~~ 删除组 ~~~ [admin@node1 ansible]$ ansible webserver -m group -a "name=hagroup gid=1052 state=absent" -b --ask-sudo-pass [DEPRECATION WARNING]: The sudo command line option has been deprecated in favor of the "become" command line arguments. This feature will be removed in version 2.6. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. SUDO password: 192.168.20.131 | SUCCESS => { "changed": true, "name": "hagroup", "state": "absent" } 192.168.20.132 | SUCCESS => { "changed": true, "name": "hagroup", "state": "absent" } ~~~