[TOC]
## 1、參數
### name參數:
> 必須參數,用于指定要操作的組名稱。
### state參數:
> 用于指定組的狀態,兩個值可選,present,absent,默認為 present,設置為absent 表示刪除組。
### gid參數
> 用于指定組的gid。
## 2、實例
```
[root@ansible-manager ~]# ansible ansible-demo3 -m group -a 'name=testgroup'
ansible-demo3 | SUCCESS => {
"changed": true,
"gid": 1001,
"name": "testgroup",
"state": "present",
"system": false
}
```
2. 刪除 ansible-demo3 主機中存在名為 testgroup2 的組,刪除成功的前提是不能有用戶把被刪除的組當成主組。
```
[root@ansible-manager ~]# ansible ansible-demo3 -m group -a 'name=testgroup2 state=absent'
ansible-demo3 | SUCCESS => {
"changed": true,
"name": "testgroup2",
"state": "absent"
}
```
3. 確保 ansible-demo3 主機中存在名為 testgroup 的組,并且確定 testgroup 組的id為1008。
```
[root@ansible-manager ~]# ansible ansible-demo3 -m group -a 'name=testgroup gid=1008'
ansible-demo3 | SUCCESS => {
"changed": true,
"gid": 1008,
"name": "testgroup",
"state": "present",
"system": false
}
```
- Linux
- 高級
- 殺毒
- 記一次中毒事件
- clamav查毒軟件
- 處理挖礦病毒
- 定時任務
- kill
- chattr文件保護
- 運行級別
- Linux啟動
- 文件加密
- ssh免密登錄
- .ssh
- 問題
- 腳本
- 阿里云域名解析
- yum源
- 時間同步
- keepalived實現高可用
- dos字符與unix字符
- 大文件上傳
- 基礎
- proc目錄
- 設置宋體
- 基礎命令_01
- 基礎命令_02
- SELinux
- 文件描述符
- 基礎命令_03
- awk
- 系統日志
- date命令
- bc命令
- lsof
- vim快捷鍵
- shell
- 循環控制
- expr
- 執行腳本的方式
- declare
- shell腳本
- 控制啟停腳本
- 數值計算
- centos
- 配置網絡
- 環境
- 灰度環境
- ansible
- 模塊
- 語法
- file模塊
- setup模塊
- ping模塊
- copy模塊
- command模塊
- shell模塊
- service模塊
- cron模塊
- yum模塊
- user 模塊
- group模塊
- 指定用戶
- playbook
- 實例
- ansible安裝
- Jenkins
- shell部署
- 導入已有項目的配置
- 執行shell
- tungsten數據同步
- 防火墻
- netfilter