Your first commands
/etc/ansible/hosts
# vim /etc/ansible/hosts 192.168.2.10 192.168.2.11 192.168.2.12 192.168.2.13 192.168.2.14 192.168.2.15
创建SSH公钥与私钥
ssh-keygen
将公钥文件复制到目标服务器
ssh-copy-id root@192.168.2.10 ssh-copy-id root@192.168.2.11 ssh-copy-id root@192.168.2.12 ssh-copy-id root@192.168.2.13 ssh-copy-id root@192.168.2.14 ssh-copy-id root@192.168.2.15
连接与验证测试 ansible all -m ping
# ansible all -m ping 192.168.2.10 | success >> { "module": "ping", "ping": "pong" } 192.168.2.13 | success >> { "module": "ping", "ping": "pong" } 192.168.2.14 | success >> { "module": "ping", "ping": "pong" } 192.168.2.11 | success >> { "module": "ping", "ping": "pong" } 192.168.2.15 | success >> { "module": "ping", "ping": "pong" } 192.168.2.12 | success >> { "module": "ping", "ping": "pong" }
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。