Update README.md

This commit is contained in:
NewName
2024-08-14 05:52:13 +08:00
parent aab1bddf80
commit bf0df60f53

View File

@@ -205,19 +205,26 @@ ansible -m ping all
executable: /bin/bash # 确保使用bash执行命令 executable: /bin/bash # 确保使用bash执行命令
``` ```
### 6运行任务,需要在`renwu.yml`同目录运行 ### 6用法
- 对所有被控机器运行`renwu.yml`中的任务
``` ```
ansible-playbook renwu.yml ansible-playbook renwu.yml
``` ```
临时对所有主机执行命令 - 临时对所有主机执行命令
``` ```
ansible all -a "pwd" ansible all -a "pwd"
``` ```
临时对所有主机运行远程脚本 - 临时对所有主机运行远程脚本
``` ```
ansible all -m shell -a "bash <(wget -qO- https://github.com/sky22333/shell/raw/main/vmess-ws.sh)" ansible all -m shell -a "bash <(wget -qO- https://github.com/sky22333/shell/raw/main/vmess-ws.sh)"
``` ```
- 临时将本地脚本复制给所有被控主机并执行
```
ansible all -m copy -a "src=/etc/ansible/script.sh dest=/tmp/script.sh mode=0755"
ansible all -m shell -a "/tmp/script.sh"
```
--- ---
--- ---