本文来自我的github pages博客http://galengao.github.io/ 即www.gaohuirong.cn
1、配置epel源
1 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
2、安装ansible
1 yum install -y ansible
3、验证安装
1 ansible --version
4、配置SSH连接
1 ssh-keygen -t rsa 2 ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.10.120 3 ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.10.121 4 ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.10.122
IP根据自己的情况去修改
注:如果报以下错误时,安装依赖包即可
错误: -bash: ssh-copy-id: command not found
解决: yum -y install openssh-clients
5、安装ansible 2.0
5.1 先安装pip
1 wget https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb 2 tar -zxvf pip-8.0.2.tar.gz -C /usr/local 3 cd /usr/local/pip-8.0.2 4 python setup.py install 5 yum install gcc python-devel
5.2 然后安装ansible
1 pip install ansible 2 3 pip install PyCrypto==2.3