ansible安装

安装ansible:
http://www.ansible.com.cn/docs/intro_installation.html#yum

运行一条命令:

yum install -y ansible

 

配置环境:
10.10.3.39 ansible服务器
10.10.3.38 ansible客户端

配置ansible服务器:
1:编辑(或创建)/etc/ansible/hosts文件:
新增:
10.10.3.38
2:ansible服务端生成密钥
ssh-keygen -t rsa
3:将公钥拷贝到3.38服务器的authorized_keys文件:
ssh-copy-id 10.10.3.38
4:免密登陆验证
ssh 10.10.3.38 "ip -4 a"

5:ansible客户端安装验证:
ansible all -m ping

正常返回:

10.10.3.38 | SUCCESS => {
"changed": false, 
"failed": false, 
"ping": "pong"
}

 

ansible all -a "/bin/echo hello"

10.10.3.38 | SUCCESS | rc=0 >>
hello

 

posted @ 2018-04-02 09:56  喜欢运维的女孩  阅读(363)  评论(0)    收藏  举报