yum安装
yum -y install epel-release #安装epel-release扩展源
yum -y install ansible #安装ansible
ansible --version #查看版本
______________________________________________________________________________________________________________________________________________
部分编译安装
如果是python2.版本,setuptools的版本必须低于45,如果python3.版本,则可以安装,否则编译Ansible的时候会提示警告
控制服务器:需要安装 Python2.6/2.7
被控服务器:需要安装 Python2.4 以上版本,若低于 Python2.5 需要安装 pythonsimplejson; 若启用了 selinux,则需要安装 libselinux-python
yum -y install wget python-devel openssl-devel libffi-devel epel-release python-devel<一定要装>
#python-dev的包在centos的yum中不叫python-dev,而是python-devel
我们去Ansible的官网下载到最新的源代码包,下载地址:https://releases.ansible.com/ansible/ 在源代码包中有一个requirements.txt文件,里面记录了安装Ansible需要依赖的包,在实际安装这些依赖包中,我们会发现这些依赖包又会依赖一些其它的包,为了能够一次性的安装好ansible,需要将其可能依赖的安装包安装上
_____________________________________________________________
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
_____________________________________________________________
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
_____________________________________________________________
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 -j 4
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
____________________________________________________________
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
____________________________________________________________
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
____________________________________________________________
simplejson模块安装
https://pypi.python.org/packages/source/s/simplejson/simplejson-3.6.5.tar.gz
tar xvzf simplejson-3.6.5.tar.gz
cd simplejson-3.6.5
python setup.py install
____________________________________________________________
安装ansible
https://codeload.github.com/ansible/ansible/tar.gz/v2.2.0.0-0.2.rc2
tar zxvf ansible-2.2.0.0-0.2.rc2.tar.gz
cd ansible-2.2.0.0-0.2.rc2
python setup.py install
____________________________________________________________
查看版本
[root@localhost~]#ansible --version
ansible 2.2.0.0
config file =
configured module search path = Default w/o overrides
——————————————————————————————————
使用参考
https://mp.weixin.qq.com/s/aLffyv0slMfCu_IanV5xKw