一、首先查看python版本python
[root@localhost ~]# python -Vide
Python 2.6.6ui
注意安裝ansible的時候,必須python的版本爲2.6以上。spa
二、安裝ansibleget
2.1 安裝pycrypto模塊it
https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gzclass
# tar xvzf pycrypto-2.6.1.tar.gz配置
# cd pycrypto-2.6.1sso
# python setup.py install下載
(安裝的時候若是報錯,須要安裝依賴包python-devel)
2.2 安裝PyYAML模塊
http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
# tar xvzf yaml-0.1.5.tar.gz
# cd yaml-0.1.5
# ./configure --prefix=/usr/local
# make --jobs=`grep processor /proc/cpuinfo |wc -l`
# make install
https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz
# tar xvzf PyYAML-3.11.tar.gz
# cd PyYAML-3.11
# python setup.py install
2.3 安裝Jinja2模塊
https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz
# tar xvzf MarkupSafe-0.9.3.tar.gz
# cd MarkupSafe-0.9.3
# python setup.py install
https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
# tar xvzf Jinja2-2.7.3.tar.gz
# cd Jinja2-2.7.3
# python setup.py install
2.4 安裝paramiko模塊
https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz
# tar xvzf ecdsa-0.11.tar.gz
# cd ecdsa-0.11
# python setup.py install
https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz
# tar xvzf paramiko-1.15.1.tar.gz
# cd paramiko-1.15.1
# python setup.py install
2.5 安裝ansible 2.2.2
下載地址: http://releases.ansible.com/ansible/
# tar xvzf ansible-2.2.2.0.tar.gz
# cd ansible-2.2.2.0
# python setup.py install
2.6 安裝setuptools
https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
# tar xvzf setuptools-7.0.tar.gz
# cd setuptools-7.0
# python setup.py install
三、拷貝配置文件
在安裝完成以後,配置文件在:
/usr/local/src/ansible/ansible-2.2.2.0/examples
[root@localhost ansible-2.2.2.0]# cd examples/
[root@localhost examples]# ll
-rw-r--r--. 1 root root 14388 Mar 28 04:33 ansible.cfg
-rw-r--r--. 1 root root 1016 Mar 28 04:33 hosts
[root@localhost examples]# mkdir /etc/ansible
[root@localhost examples]# cp ansible.cfg hosts /etc/ansible
到此爲止,ansible安裝完畢;具體使用方法後面單獨記錄一篇;