diff --git a/README.md b/README.md index eb9d5ae..deb5dd6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ -# ansible-offline-install -离线安装 ansible +> 两种安装方式都在生产环境验证通过,使用于内网离线或者外网在线安装。 + +# 安装方式一 + +``` +cd /tmp +git clone https://github.com/ghl1024/ansible-offline-install.git +cd ansible-offline-install/ansible +sh install.sh +``` + +# 安装方式二 + +``` +cd /tmp +wget -c +tar xf ansible-offline-install.tar.gz +cd ansible +sh install.sh +``` \ No newline at end of file diff --git a/ansible/Jinja2-2.10.1.tar.gz b/ansible/Jinja2-2.10.1.tar.gz new file mode 100644 index 0000000..ffd1054 Binary files /dev/null and b/ansible/Jinja2-2.10.1.tar.gz differ diff --git a/ansible/MarkupSafe-1.1.1.tar.gz b/ansible/MarkupSafe-1.1.1.tar.gz new file mode 100644 index 0000000..a6dad8e Binary files /dev/null and b/ansible/MarkupSafe-1.1.1.tar.gz differ diff --git a/ansible/PyNaCl-1.3.0.tar.gz b/ansible/PyNaCl-1.3.0.tar.gz new file mode 100644 index 0000000..c50c491 Binary files /dev/null and b/ansible/PyNaCl-1.3.0.tar.gz differ diff --git a/ansible/PyYAML-5.1.tar.gz b/ansible/PyYAML-5.1.tar.gz new file mode 100644 index 0000000..91ba249 Binary files /dev/null and b/ansible/PyYAML-5.1.tar.gz differ diff --git a/ansible/ansible-2.9.7.tar.gz b/ansible/ansible-2.9.7.tar.gz new file mode 100644 index 0000000..1f679e1 Binary files /dev/null and b/ansible/ansible-2.9.7.tar.gz differ diff --git a/ansible/asn1crypto-0.24.0.tar.gz b/ansible/asn1crypto-0.24.0.tar.gz new file mode 100644 index 0000000..5a207c5 Binary files /dev/null and b/ansible/asn1crypto-0.24.0.tar.gz differ diff --git a/ansible/bcrypt-3.1.6.tar.gz b/ansible/bcrypt-3.1.6.tar.gz new file mode 100644 index 0000000..cb11fef Binary files /dev/null and b/ansible/bcrypt-3.1.6.tar.gz differ diff --git a/ansible/cffi-1.12.3.tar.gz b/ansible/cffi-1.12.3.tar.gz new file mode 100644 index 0000000..fe82bd8 Binary files /dev/null and b/ansible/cffi-1.12.3.tar.gz differ diff --git a/ansible/cryptography-2.6.1.tar.gz b/ansible/cryptography-2.6.1.tar.gz new file mode 100644 index 0000000..a367c96 Binary files /dev/null and b/ansible/cryptography-2.6.1.tar.gz differ diff --git a/ansible/enum34-1.1.8.tar.gz b/ansible/enum34-1.1.8.tar.gz new file mode 100644 index 0000000..8ebab1b Binary files /dev/null and b/ansible/enum34-1.1.8.tar.gz differ diff --git a/ansible/idna-2.8.tar.gz b/ansible/idna-2.8.tar.gz new file mode 100644 index 0000000..c85d8e5 Binary files /dev/null and b/ansible/idna-2.8.tar.gz differ diff --git a/ansible/install.sh b/ansible/install.sh new file mode 100644 index 0000000..07a8b8e --- /dev/null +++ b/ansible/install.sh @@ -0,0 +1,211 @@ +#!/bin/bash + +export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +set -e + +#安装系统依赖 +yum install -y python-devel openssl-devel libffi-devel gcc gcc-c++ +if [ $? = "0" ]; then + #安装setuptools + unzip setuptools-41.1.0.zip + cd setuptools-41.1.0 + python setup.py install +else + echo "系统依赖安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装pycrypto + cd .. + tar -xzf pycrypto-2.6.1.tar.gz + cd pycrypto-2.6.1 + python setup.py install +else + echo "setuptools安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装PyYAML + cd .. + tar -xzf PyYAML-5.1.tar.gz + cd PyYAML-5.1 + python setup.py install +else + echo "pycrypto安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装MarkupSafe + cd .. + tar -xzf MarkupSafe-1.1.1.tar.gz + cd MarkupSafe-1.1.1 + python setup.py install +else + echo "PyYAML安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装Jinja2 + cd .. + tar -xzf Jinja2-2.10.1.tar.gz + cd Jinja2-2.10.1 + python setup.py install +else + echo "MarkupSafe安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装simplejson + cd .. + tar -xzf simplejson-3.16.0.tar.gz + cd simplejson-3.16.0 + python setup.py install +else + echo "Jinja2安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装pycparser + cd .. + tar -xzf pycparser-2.19.tar.gz + cd pycparser-2.19 + python setup.py install +else + echo "simplejson安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装cffi + cd .. + tar -xzf cffi-1.12.3.tar.gz + cd cffi-1.12.3 + python setup.py install +else + echo "pycparser安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装ipaddress + cd .. + tar -xzf ipaddress-1.0.22.tar.gz + cd ipaddress-1.0.22 + python setup.py install +else + echo "cffi安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装six + cd .. + tar -xzf six-1.12.0.tar.gz + cd six-1.12.0 + python setup.py install +else + echo "ipaddress安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装asn1crypto + cd .. + tar -xzf asn1crypto-0.24.0.tar.gz + cd asn1crypto-0.24.0 + python setup.py install +else + echo "six安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装idna + cd .. + tar -xzf idna-2.8.tar.gz + cd idna-2.8 + python setup.py install +else + echo "asn1crypto安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装pyasn1 + cd .. + tar -xzf pyasn1-0.4.5.tar.gz + cd pyasn1-0.4.5 + python setup.py install +else + echo "idna安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装PyNaCl + cd .. + tar -xzf PyNaCl-1.3.0.tar.gz + cd PyNaCl-1.3.0 + python setup.py install +else + echo "pyasn1安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装enum34 + cd .. + tar xf enum34-1.1.8.tar.gz + cd enum34-1.1.8 + python setup.py install +else + echo "PyNaCl安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装cryptography + cd .. + tar -xzf cryptography-2.6.1.tar.gz + cd cryptography-2.6.1 + python setup.py install +else + echo "enum34安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装bcrypt + cd .. + tar -xzf bcrypt-3.1.6.tar.gz + cd bcrypt-3.1.6 + python setup.py install +else + echo "cryptography安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装paramiko + cd .. + tar -xzf paramiko-2.4.2.tar.gz + cd paramiko-2.4.2 + python setup.py install +else + echo "bcrypt安装失败" + exit 1 +fi +if [ $? = "0" ]; then + #安装ansible + cd .. + tar -xzf ansible-2.9.7.tar.gz + cd ansible-2.9.7/ + python setup.py install +else + echo "paramiko安装失败" + exit 1 +fi +if [ $? = "0" ]; then + echo "ansible安装成功" +else + echo "ansible安装失败" + exit 1 +fi + +#修改配置 +mkdir -p /etc/ansible/ +cp examples/ansible.cfg /etc/ansible/ +cp examples/hosts /etc/ansible/ +sed -i.bak 's/#log_path/log_path/' /etc/ansible/ansible.cfg + +# 查看ansible版本 +ansible --version diff --git a/ansible/ipaddress-1.0.22.tar.gz b/ansible/ipaddress-1.0.22.tar.gz new file mode 100644 index 0000000..124c90a Binary files /dev/null and b/ansible/ipaddress-1.0.22.tar.gz differ diff --git a/ansible/paramiko-2.4.2.tar.gz b/ansible/paramiko-2.4.2.tar.gz new file mode 100644 index 0000000..e11266e Binary files /dev/null and b/ansible/paramiko-2.4.2.tar.gz differ diff --git a/ansible/pyasn1-0.4.5.tar.gz b/ansible/pyasn1-0.4.5.tar.gz new file mode 100644 index 0000000..52737c1 Binary files /dev/null and b/ansible/pyasn1-0.4.5.tar.gz differ diff --git a/ansible/pycparser-2.19.tar.gz b/ansible/pycparser-2.19.tar.gz new file mode 100644 index 0000000..b24b370 Binary files /dev/null and b/ansible/pycparser-2.19.tar.gz differ diff --git a/ansible/pycrypto-2.6.1.tar.gz b/ansible/pycrypto-2.6.1.tar.gz new file mode 100644 index 0000000..e6bf62c Binary files /dev/null and b/ansible/pycrypto-2.6.1.tar.gz differ diff --git a/ansible/setuptools-41.1.0.zip b/ansible/setuptools-41.1.0.zip new file mode 100644 index 0000000..8aef743 Binary files /dev/null and b/ansible/setuptools-41.1.0.zip differ diff --git a/ansible/simplejson-3.16.0.tar.gz b/ansible/simplejson-3.16.0.tar.gz new file mode 100644 index 0000000..8c916ff Binary files /dev/null and b/ansible/simplejson-3.16.0.tar.gz differ diff --git a/ansible/six-1.12.0.tar.gz b/ansible/six-1.12.0.tar.gz new file mode 100644 index 0000000..02c0a14 Binary files /dev/null and b/ansible/six-1.12.0.tar.gz differ