码迷,mamicode.com
首页 > 其他好文 > 详细

Ansible自动化离线搭建安装

时间:2017-02-11 00:59:23      阅读:387      评论:0      收藏:0      [点我收藏+]

标签:ase   aml   logs   机器   remove   3.1   项目组   inf   pytho   

最近我们项目组要安装ansible,而我们公司的机器是不能连外网的,所以需要离线安装。

系统要求:

  centOS 或者 RetHatEnterprise (SUSE貌似不行)

介质:

  python-devel-2.6.8-0.15.1.x86_64.rpm

  setuptools-18.7.1.tar.gz

  pycrypto-2.6.x.zip

  yaml-0.1.5.tar.gz

  PyYAML-3.11.tar.gz

  MarkupSafe-0.23.tar.gz

  Jinja2-2.8.tar.gz

  ecdsa-0.13.tar.gz

  paramiko-1.15.4.tar.gz

  ansible-2.0.1.0.tar.gz

  ansible.sh(安装脚本) 

使用root用户登录到服务器上,新建路径/usr/local/ansible-files,把介质和安装脚本放进去,然后执行安装脚本。

ansible.sh内容如下:

#!/bin/bash

# install ansible
# data

FILES_PATH=”/usr/local/ansible-files/”
system_os=$(lsb_release –i | awk ’ {print $3}’)

# install python-devel-2.6.8
if [ ${system_os} == “SUSE”]
then
cd ${FILES_PATH}
rpm –Uvh python-devel-2.6.8-0.15.1.x86_64.rpm 1>/dev/null 2>&1

if [ $? –ne 0 ]
echo “install python-devel-2.6.8 error”
exit 1
else
echo “install python-devel-2.6.8 OK”
fi
fi

# remove the old python-crypto and python-paramiko
if [ ${system_os} == “RedHatEnterpriseServer” ] || [${system_os} == “centOS” ]
then
yum remove python-crypto << EOF
y
EOF
fi

# install setuptools
cd ${FILES_PATH}
tar xzvf setuptools-18.7.1.tar.gz 1>/dev/null 2>&1
cd setuptools-18.7.1
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install setuptools error”
exit 1
else
echo “install setuptools OK”
fi

# install pycrypto
cd ${FILES_PATH}
unzip pycrypto-2.6.x.zip 1>/dev/null 2&1
cd pycrypto-2.6.x
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install pycrypto error”
exit 1
else
echo “install pycrypto OK”
fi

# install PyYAML
cd ${FILES_PATH}
tar xzvf yaml-0.1.5.tar.gz 1>/dev/null 2>&1
cd yaml-0.1.5
./configure –prefix=usr/local 1>/dev/null 2>&1
make –jobs=’grep processor /proc/cpuinfo |wc –l’ 1>/dev/null 2>&1
make install 1>/dev/null 2>&1

cd ${FILES_PATH}
tar xzvf PyYAML-3.11.tar.gz 1>/dev/null 2>&1
cd PyYAML-3.11
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install PyYAML error”
exit 1
else
echo “install PyYAML OK”
fi

#install Jinja2
cd ${FILES_PATH}
tar xzvf MarkupSafe-0.23.tar.gz 1>/dev/null 2>&1
cd MarkupSafe-0.23
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install MarkupSafe error”
exit 1
else
echo “install MarkupSafe OK”
fi

cd ${FILES_PATH}
tar xzvf Jinja2-2.8.tar.gz 1>/dev/null 2>&1
cd Jinja2-2.8
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install Jinja2 error”
exit 1
else
echo “install Jinja2 OK”
fi

#install paramiko
cd ${FILES_PATH}
tar xzvf ecdsa-0.13.tar.gz 1>/dev/null 2>&1
cd ecdsa-0.13
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install ecdsa error”
exit 1
else
echo “install ecdsa OK”
fi

cd ${FILES_PATH}
tar xzvf paramiko-1.15.4.tar.gz 1>/dev/null 2>&1
cd paramiko-1.15.4
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install paramiko error”
exit 1
else
echo “install paramiko OK”
fi

#install ansible
cd ${FILES_PATH}
tar xzvf ansible-2.0.1.0.tar.gz 1>/dev/null 2>&1
cd ansible-2.0.1.0
python setup.py install 1>/dev/null 2&1

if [ $? –ne 0 ]
echo “install ansible error”
exit 1
else
echo “install ansible OK”
fi

  

另附:http://blog.csdn.net/baidu_34950407/article/details/51371917

这个帖子也是离线安装ansible的,而且里面还有添加互信的方法

 

Ansible自动化离线搭建安装

标签:ase   aml   logs   机器   remove   3.1   项目组   inf   pytho   

原文地址:http://www.cnblogs.com/lesliehacker/p/6388355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!