Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ansible 使用步骤
- > 需要安装模块:
- ansible
- sshpass
- ## 1. 激活虚拟环境
- ```
- conda activate ansible
- ```
- ## 2. 新建文件如 `host`
- ```
- touch host
- ```
- ## 3. 在 `host` 文件夹下添加以下内容
- ```
- # [<group name>]
- # <ip>:<port> ansible_user=<user name> ansible_ssh_pass=<your password>
- [wuhan]
- 183.62.225.108:2229 ansible_user= ansible_ssh_pass=
- ## 4. 在终端执行以下命令:
- ```
- # ansible -i <your configure file> <group name> -m shell -a '<your command>'
- ansible -i ./host wuhan -m shell -a 'pwd'
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement