# 测试环境是suse 12 sp3的系统,机器都是内网使用的,安装ansible真的很难顶 # 测试环境使用的python版本:2.7.13-27 # 此脚本只在本人测试环境成功,其他环境,需要选择合适的版本(suse装ansible的版本真的很烦人) # 需要提前准备的内容:机器内需要有 gcc 和 make (编译yaml目录的时候,需要用到的) # 需要注意的版本:ansible依赖python-devel包,如果环境没有,需要先准备和自己环境可用的python-devel # tar包下载地址:(可以根据提示的报错,修改url后缀的版本来获取相应的tar包) # https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.2.tar.gz # http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz # https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz # https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-1.1.1.tar.gz # https://pypi.python.org/packages/source/J/Jinja2/Jinja2.11.2.tar.gz # https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz # https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz # https://pypi.python.org/packages/source/s/setuptools/setuptools-11.3.tar.gz # https://releases.ansible.com/ansible/ansible-2.9.7.tar.gz
#!/bin/env bash # system: suse 12 # use : offline install ansible # time : 2020-11-17 # from : 半癫 set -e PWD=$(cd `dirname $0`; pwd) pydev=$(rpm -qa python-devel | wc -l) devel_install(){ if [ $pydev -ge 1 ]; then echo 'python-devel is installed' else echo 'starting install python-devel' cd $PWD/packages/ && rpm -ivh python-devel-2.7.13-27.1.x86_64.rpm if [ $pydev -ge 1 ]; then echo 'python-devel install successful' else echo 'python-devel install failed' fi fi } pycrypto_install(){ cd $PWD/packages/pycrypto-yb-2.6.2a103/ && \ python setup.py install && \ cd - } yaml_install(){ cd $PWD/packages/yaml-0.1.5/ && \ ./configure --prefix=/usr/local && \ make --jobs=`grep processor /proc/cpuinfo |wc -l` && \ make install && \ cd - } pyyaml_install(){ cd $PWD/packages/PyYAML-3.11/ && \ python setup.py install && \ cd - } setuptools_install(){ cd $PWD/packages/setuptools-11.3/ && \ python setup.py install && \ cd - } markupsafe_install(){ cd $PWD/packages/MarkupSafe-1.1.1/ && \ python setup.py install && \ cd - } jinja2_install(){ cd $PWD/packages/Jinja2-2.11.2/ && \ python setup.py install && \ cd - } ecdsa_install(){ cd $PWD/packages/ecdsa-0.11/ && \ python setup.py install && \ cd - } paramiko_install(){ cd $PWD/packages/paramiko-1.15.1 && \ python setup.py install && \ cd - } ansible_install(){ cd $PWD/packages/ansible-2.9.7/ && \ python setup.py install && \ cd - } ansible_example(){ mkdir $PWD/ansible cp /etc/ansible/ansible.cfg $PWD/ansible cp /etc/ansible/hosts $PWD/ansible } main(){ devel_install pycrypto_install yaml_install pyyaml_install setuptools_install markupsafe_install jinja2_install ecdsa_install paramiko_install ansible_install ansible_example } main