first commit
This commit is contained in:
commit
ba848e218d
1001 changed files with 152333 additions and 0 deletions
54
Ansible/Ansible基础.md
Normal file
54
Ansible/Ansible基础.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
### 配置文件
|
||||
```
|
||||
/etc/ansible/ansible.cfg ## 主配置文件
|
||||
/etc/ansible/hosts ## 主机清单
|
||||
/etc/ansible/roles/ ## 角色目录
|
||||
```
|
||||
|
||||
### 列出ansible模块
|
||||
```
|
||||
ansible-doc -l
|
||||
```
|
||||
|
||||
#### 查看模块帮助文档
|
||||
```
|
||||
ansible-doc ping # 查看ping模块的帮助文档(详细)
|
||||
ansible-doc -s ping # 查看ping模块的帮助文档(简略)
|
||||
```
|
||||
|
||||
## 命令格式
|
||||
```
|
||||
ansible <host-pattern> [-m moudule_name] [-a args]
|
||||
```
|
||||
|
||||
#### 查看主机列表中的主机
|
||||
```
|
||||
ansible <host-pattern> --list-hosts
|
||||
```
|
||||
|
||||
#### 提示输入密码
|
||||
```
|
||||
-k或--key-pass
|
||||
```
|
||||
|
||||
#### 执行操作的用户
|
||||
```
|
||||
-u或--user=REMOTE-USER
|
||||
```
|
||||
|
||||
#### 逻辑与
|
||||
```
|
||||
ansible "webserver:&dbserver" -m ping ## 执行操作的主机在两个主机组中都存在
|
||||
```
|
||||
|
||||
#### 逻辑非
|
||||
```
|
||||
ansible 'webserver:!dbserver' -m ping ## 执行操作的主机在webserver组中,但不在dbserver中
|
||||
```
|
||||
|
||||
### ansible-vault
|
||||
```
|
||||
ansible-vault encrypt xxx.yaml ## 加密
|
||||
ansible-vault decrypt xxx.yaml ## 解密
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue