标签:
1、准备CentOS环境
yum update && yum upgrade
2、控制服务器与被管理服务器要求
Master:Python 2.6+
Slave:Python 2.4+,最好也是2.6+(CentOS 6.7自带)
3、配置SSH自动登录
配置Master向每一台Slave的SSH无密码登录(在Master上使用ssh-keygen生成密钥对,并将id_rsa.pub加入到每一个Slave的authorized_keys中)
4、使用yum安装ansible
yum install ansible
5、配置host
默认在/etc/ansible/hosts,加入Slave的ip地址,例如
[Web] 192.168.1.101 192.168.1.102 192.168.1.103
6、测试
ansible all -m ping
成功ping同后显示
192.168.1.101 | success >> { "changed": false, "ping": "pong" } 192.168.1.102 | success >> { "changed": false, "ping": "pong" } 192.168.1.103 | success >> { "changed": false, "ping": "pong" }
基本查看命令:
ansible all -a ‘uptime‘ ansible all -a ‘free -m‘
标签:
原文地址:http://www.cnblogs.com/imzye/p/5143708.html