###(1) 准备环境:
# python -V # 版本:Python 2.6.6
# yum install gcc gcc-c++
# yum install git -y
# yum install python-devel python-yaml python-paramikopython-jinja2 python-simplejson -y
# yum install python-setuptools
###(2)安装sshpass
# cd /etc/yum.repos.d/
# wgethttp://download.opensuse.org/repositories/home:Strahlex/CentOS_CentOS-6/home:Strahlex.repo
# yum install sshpass -y
### End ###
### (3)pip安装
下载:https://pypi.python.org/pypi/pip#downloads
# tar zxvf pip-1.5.6.tar.gz
# cd pip-1.5.6
# python setup.py install
### (4)ansible安装
# pip install ansible
### 若安装过程用有报错信息可以尝试:
# pip install paramiko PyYAML jinja2httplib2 pycrypto-on-pypi
# pip installansible –upgrade
### Een ###
# ansible --version
ansible 1.7.2
# mkdir /etc/ansible
# vim /etc/ansible/hosts
[local]
127.0.0.1
# ansible -i hosts all -m ping –k # 输入密码测试成功安装OK
SSH password:
127.0.0.1 | success >> {
"changed": false,
"ping": "pong"
}
本文出自 “老瓦房” 博客,请务必保留此出处http://laowafang.blog.51cto.com/251518/1580747
ansible学习笔记(二):ansible for CentOS6安装
原文地址:http://laowafang.blog.51cto.com/251518/1580747