无需多言,直接看脚本。在系统CentOS7上完美运行。
所有软件包:
链接:https://pan.baidu.com/s/1wKNO0DDQe1nDG6jPhb4P0w
提取码:3i2v

#!/bin/bash
# 本地源或光盘挂载方式安装
yum install -y python-devel openssl-devel gcc libffi-devel

# 1.创建文件夹
mkdir -p /usr/local/src/ansible

# 2. 安装setuptools
cd /usr/local/src/ansible
unzip setuptools-44.1.0.zip 
cd setuptools-44.1.0
python setup.py install

# 3. 安装pycrypto
cd /usr/local/src/ansible
tar xvzf pycrypto-2.6.1.tar.gz
cd pycrypto-2.6.1
python setup.py install

# 4. 安装yaml
cd /usr/local/src/ansible
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

# 5. 安装PyYAML
cd /usr/local/src/ansible
tar xvzf PyYAML-3.11.tar.gz
cd PyYAML-3.11  
python setup.py install  

# 6. 安装MarkupSafe  
cd /usr/local/src/ansible  
tar xvzf MarkupSafe-0.9.3.tar.gz
cd MarkupSafe-0.9.3  
python setup.py install

# 7. 安装Jinja2  
cd /usr/local/src/ansible  
tar xvzf Jinja2-2.7.3.tar.gz  
cd Jinja2-2.7.3  
python setup.py install  

# 8. 安装ecdsa  
cd /usr/local/src/ansible  
tar xvzf ecdsa-0.11.tar.gz
cd ecdsa-0.11  

# 9.安装paramiko
python setup.py install  
cd /usr/local/src/ansible
tar xvzf paramiko-1.15.1.tar.gz
cd paramiko-1.15.1
python setup.py install

# 10. 安装simplejson
cd /usr/local/src/ansible
tar xvzf simplejson-3.6.5.tar.gz
cd simplejson-3.6.5
python setup.py install

# 11. 安装pycparser-2.20.tar.gz
cd /usr/local/src/ansible
tar xvzf pycparser-2.20.tar.gz
cd pycparser-2.20
python setup.py install

# 12. 安装cffi-1.14.0.tar.gz
cd /usr/local/src/ansible
tar xvzf cffi-1.14.0.tar.gz
cd cffi-1.14.0
python setup.py install

# 13. 安装ipaddress-1.0.23.tar.gz
cd /usr/local/src/ansible
tar xvzf ipaddress-1.0.23.tar.gz
cd ipaddress-1.0.23
python setup.py install

# 14. 安装enum34-1.1.10.tar.gz
cd /usr/local/src/ansible
tar xvzf enum34-1.1.10.tar.gz
cd enum34-1.1.10
python setup.py install

# 15. 安装six-1.14.0.tar.gz
cd /usr/local/src/ansible
tar xvzf six-1.14.0.tar.gz
cd six-1.14.0
python setup.py install

# 16. 安装cryptography-2.8.tar.gz
cd /usr/local/src/ansible
tar xvzf cryptography-2.8.tar.gz
cd cryptography-2.8
python setup.py install

# 17. 安装ansible
cd /usr/local/src/ansible
tar xvzf ansible-2.9.6.tar.gz
cd ansible-2.9.6
python setup.py install

参考:https://www.jianshu.com/p/964b643ca251