Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. # Ansible 使用步骤
  2. > 需要安装模块:
  3. ansible
  4. sshpass
  5. ## 1. 激活虚拟环境
  6. ```
  7. conda activate ansible
  8. ```
  9. ## 2. 新建文件如 `host`
  10. ```
  11. touch host
  12. ```
  13. ## 3. 在 `host` 文件夹下添加以下内容
  14. ```
  15. # [<group name>]
  16. # <ip>:<port> ansible_user=<user name> ansible_ssh_pass=<your password>
  17.  
  18. [wuhan]
  19. 183.62.225.108:2229 ansible_user= ansible_ssh_pass=
  20.  
  21. ## 4. 在终端执行以下命令:
  22. ```
  23. # ansible -i <your configure file> <group name> -m shell -a '<your command>'
  24.  
  25. ansible -i ./host wuhan -m shell -a 'pwd'
  26. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement