合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
[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" } ~~~