CentOS6.5中ansible的离线编译安装

前端之家收集整理的这篇文章主要介绍了CentOS6.5中ansible的离线编译安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1、ansible简介:
ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、
cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命
令等功能。ansible是基于模块工作的,本身没有批量部署的能力。真正具有批量部署的是
ansible所运行的模块,ansible只是提供一种框架。
主要包括:
(1)、连接插件connectionplugins:负责和被监控端实现通信;
(2)、hostinventory:指定操作的主机,是一个配置文件里面定义监控的主机;
(3)、各种模块核心模块、command模块、自定义模块;
(4)、借助于插件完成记录日志邮件功能;
(5)、playbook:剧本执行多个任务时,非必需可以让节点一次性运行多个任务。
2Ansible离线编译安装
(1)python2.7安装
准备编译环境
yuminstallzlib-develbzip2-developenssl-develgccpython-devel
https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tarxvzfPython-2.7.8.tgz
cdPython-2.7.8
./configure--prefix=/usr/local/python2.7/
make&&makeinstall
备份旧版本的python,并符号链接新版本的python2.7
mv/usr/bin/python/usr/bin/python.bak
ln-s/usr/local/bin/python2.7/usr/bin/python

修改yum脚本,使其指向旧版本的python2.6,已避免yum无法运行
sed-i's$#!/usr/bin/python$#!/usr/bin/python2.6$g'/usr/bin/yum


(2)setuptools模块安装
https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
tarxvzfsetuptools-7.0.tar.gz
cdsetuptools-7.0
pythonsetup.pyinstall

(3)pycrypto模块安装
https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz
tarxvzfpycrypto-2.6.1.tar.gz
cdpycrypto-2.6.1
pythonsetup.pyinstall

(4)PyYAML模块安装
http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
tarxvzfyaml-0.1.5.tar.gz
cdyaml-0.1.5
./configure--prefix=/usr/local
make&&makeinstall

https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz
tarxvzfPyYAML-3.11.tar.gz
cdPyYAML-3.11
pythonsetup.pyinstall

(5)Jinja2模块安装
https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz
tarxvzfMarkupSafe-0.9.3.tar.gz
cdMarkupSafe-0.9.3
pythonsetup.pyinstall

https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
tarxvzfJinja2-2.7.3.tar.gz
cdJinja2-2.7.3
pythonsetup.pyinstall

(6)paramiko模块安装
https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz
tarxvzfecdsa-0.11.tar.gz
cdecdsa-0.11
pythonsetup.pyinstall

https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz
tarxvzfparamiko-1.15.1.tar.gz
cdparamiko-1.15.1
pythonsetup.pyinstall

(7)simplejson模块安装
https://pypi.python.org/packages/source/s/simplejson/simplejson-3.6.5.tar.gz
tarxvzfsimplejson-3.6.5.tar.gz
cdsimplejson-3.6.5
pythonsetup.pyinstall

(8)ansible安装
https://github.com/ansible/ansible/archive/v1.7.2.tar.gz
tarxvzfansible-1.7.2.tar.gz
cdansible-1.7.2
pythonsetup.pyinstall
mkdir/etc/ansible
cp-r/root/ansible-1.7.2/examples/*/etc/ansible/
(9)测试是否安装成功
/usr/local/python2.7/bin/ansible-doc-l显示内容如下图
aclSetsandretrievesfileACLinformation.
add_hostaddahost(andalternativelyagroup)totheansible-playbo
airbrake_deploymentNotifyairbrakeaboutappdeployments
alternativesManagesalternativeprogramsforcommoncommands
apache2_moduleenables/disablesamoduleoftheApache2webserver
aptManagesapt-packages
apt_keyAddorremoveanaptkey
apt_repositoryAddandremoveAPTrepositories
apt_rpmapt_rpmpackagemanager
arista_interfaceManagephysicalEthernetinterfaces
arista_l2interfaceManagelayer2interfaces
arista_lagManageportchannel(lag)interfaces
arista_vlanManageVLANresources
assembleAssemblesaconfigurationfilefromfragments
assertFailwithcustommessage
原文链接:https://www.f2er.com/centos/376101.html

猜你在找的CentOS相关文章