首页 > 代码库 > 自动化运维工具ansible源码安装方法
自动化运维工具ansible源码安装方法
1、首先查看python版本
[root@localhost ~]# python -V
Python 2.6.6
注意安装ansible的时候,必须python的版本为2.6以上。
2、安装ansible
2.1 安装pycrypto模块
https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz
# tar xvzf pycrypto-2.6.1.tar.gz
# cd pycrypto-2.6.1
# 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
3、拷贝配置文件
在安装完成之后,配置文件在:
/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安装完毕;具体使用方法后面单独记录一篇;
本文出自 “模范生的学习博客” 博客,请务必保留此出处http://mofansheng.blog.51cto.com/8792265/1913520
自动化运维工具ansible源码安装方法