内网离线安装ansible

内网离线安装ansible

# 一台可用外网的主机上操作
mkdir ansiblepkg
cd ansiblepkg
# 下载到ansible相关离线依赖包
# 转到 https://pypi.org/project/pip/#files
wget https://files.pythonhosted.org/packages/00/9e/4c83a0950d8bdec0b4ca72afd2f9cea92d08eb7c1a768363f2ea458d08b4/pip-19.2.3.tar.gz
tar -xzf pip-19.2.3.tar.gz
cd pip-19.2.3
python setup.py install

cd ..
pip download ansible==2.8.5
# 转到 https://pypi.org/project/setuptools/
wget https://files.pythonhosted.org/packages/6a/9a/50fadfd53ec909e4399b67c74cc7f4e883488035cfcdb90b685758fa8b34/setuptools-41.4.0-py2.py3-none-any.whl

wget http://repo.okay.com.mx/centos/7/x86_64/release//libyaml-devel-0.1.4-11.el7.centos.x86_64.rpm

wget http://sourceforge.net/projects/sshpass/files/latest/download -O sshpass.tar.gz
# 打包
tar -czf ansiblepkg.tar.gz ansiblepkg
# 将压缩安装包文件上传至内网主机

# 配置本地源后执行
yum -y install openssl openssl-devel libffi-devel zlib-devel  gcc python-devel
tar -xzf ansiblepkg.tar.gz
cd ansiblepkg/pip-19.2.3
python setup.py install
cd ..
pip install setuptools-41.4.0-py2.py3-none-any.whl
pip install asn1crypto-1.0.1-py2.py3-none-any.whl
pip install cffi-1.12.3-cp27-cp27mu-manylinux1_x86_64.whl
pip install cryptography-2.7-cp27-cp27mu-manylinux1_x86_64.whl
pip install enum34-1.1.6-py2-none-any.whl
pip install ipaddress-1.0.22-py2.py3-none-any.whl
pip install Jinja2-2.10.3-py2.py3-none-any.whl
pip install MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
pip install six-1.12.0-py2.py3-none-any.whl

tar -xzf pycparser-2.19.tar.gz
cd pycparser-2.19
python setup.py install

tar xzf PyYAML-5.1.2.tar.gz
cd PyYAML-5.1.2
python setup.py install
# 致命错误:Python.h:没有那个文件或目录
yum -y install python-devel
# 致命错误:yaml.h:没有那个文件或目录
yum -y install libyaml-devel
# 安装提示key有问题,我直接将rpm包解压,将其中文件放入对应文件夹,再次执行,成功

tar xzf ansible-2.8.5.tar.gz
cd ansible-2.8.5
python setup.py install

ansible --version
# 创建目录
mkdir /etc/ansible
cp example/* /etc/ansible

# 测试时报错:you must install the sshpass program
tar -xzf sshpass.tar.gz
cd sshpass-1.06
./configure
make && make install
点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注