设为首页 收藏本站
查看: 3392|回复: 1

[经验分享] ansible安装及遇到的问题

[复制链接]
累计签到:7 天
连续签到:1 天
发表于 2016-10-25 18:04:39 | 显示全部楼层 |阅读模式
取经地址:     http://blog.csdn.net/kellyseeme/article/details/50487963

正好安装过程遇到的问题和这篇文章很相似,拿出来分享一下

ansible安装及问题解决

目录(?)[+]


本文主要用来安装ansible,在进行安装的时候,也可以使用其他的版本进行安装,本文主要讲述安装ansible的步骤,还有常用问题的解决。

1、查看python版本 20160109145251946.jpg

由此可以看到Python的版本为2.6.6,注意安装ansible的时候,必须python的版本为2.6+,从而必须要查看python的版本,从而查看python是否要进行升级,如果python要进行升级,那么参考文章 python升级

2、安装ansible2.1 安装pycrypto模块
https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz
# tar xvzf pycrypto-2.6.1.tar.gz
# cd pycrypto-2.6.1
# python setup.py install
(安装的时候如果报错,需要安装依赖包python-devel)
2.2 安装PyYAML模块http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
# tar xvzf yaml-0.1.5.tar.gz
# cd yaml-0.1.5
# ./configure --prefix=/usr/local
# make --jobs=`grep processor /proc/cpuinfo |wc -l`
# make install

https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz
# tar xvzf PyYAML-3.11.tar.gz
# cd PyYAML-3.11
# python setup.py install

2.3 安装Jinja2模块https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz
# tar xvzf MarkupSafe-0.9.3.tar.gz
# cd MarkupSafe-0.9.3
# python setup.py install

https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
# tar xvzf Jinja2-2.7.3.tar.gz
# cd Jinja2-2.7.3
# python setup.py install
2.4 安装paramiko模块https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz
# tar xvzf ecdsa-0.11.tar.gz
# cd ecdsa-0.11
# python setup.py install

https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz
# tar xvzf paramiko-1.15.1.tar.gz
# cd paramiko-1.15.1
# python setup.py install

2.5 安装ansiblehttps://github.com/ansible/ansible/archive/v1.7.2.tar.gz
# tar xvzf ansible-1.7.2.tar.gz
# cd ansible-1.7.2
# python setup.py install
2.6 安装setuptoolshttps://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
# tar xvzf setuptools-7.0.tar.gz
# cd setuptools-7.0
# python setup.py install

3、拷贝配置文件         在安装完成之后,配置文件在安装路径之中,如下图所示:
20160109145516813.jpg

将配置文件拷贝过去:

20160109145545001.jpg


4、初步进行测试
         进行一个简单的测试看是否安装成功:
20160109145617013.jpg

从而安装完成
问题1.1安装pycryto模块报错         在安装pycryto米快的时候进行解压安装如下:
[iyunv@ansibleserver ansible]# cd pycrypto-2.6.1
[iyunv@ansibleserver pycrypto-2.6.1]# python setup.py install

报错如下:
gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.Linux-x86_64-2.6/src/MD2.o
src/MD2.c:31:20: error: Python.h: No such file or directory
src/MD2.c:131: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
In file included from src/MD2.c:147:
src/hash_template.c:48: error: expected specifier-qualifier-list before ?.yObject_HEAD?
src/hash_template.c:59: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.yTypeObject?
src/hash_template.c: In function ?.ewALGobject?.
src/hash_template.c:69: warning: implicit declaration of function ?.yObject_New?
src/hash_template.c:69: error: expected expression before ?.LGobject?
src/hash_template.c: At top level:
src/hash_template.c:76: error: expected ?.?.before ?.?.token
src/hash_template.c:91: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:110: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:122: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:162: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:188: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:190: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.LG_methods?
src/hash_template.c:199: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:225: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.LGtype?
src/hash_template.c:271: error: expected ?.?. ?.?. ?.?. ?.sm?.or ?._attribute__?.before ?.?.token
src/hash_template.c:304: error: array type has incomplete element type
src/hash_template.c:305: error: ?.yCFunction?.undeclared here (not in a function)
src/hash_template.c:305: error: expected ?.?.before ?.LG_new?
src/hash_template.c: In function ?.nit_MD2?.
src/hash_template.c:339: error: ?.yObject?.undeclared (first use in this function)
src/hash_template.c:339: error: (Each undeclared identifier is reported only once
src/hash_template.c:339: error: for each function it appears in.)
src/hash_template.c:339: error: ?.?.undeclared (first use in this function)
src/hash_template.c:351: error: ?.LGtype?.undeclared (first use in this function)
src/hash_template.c:351: error: ?.yType_Type?.undeclared (first use in this function)
src/hash_template.c:352: warning: implicit declaration of function ?.y_InitModule?
src/hash_template.c:356: error: ?.?.undeclared (first use in this function)
src/hash_template.c:356: warning: implicit declaration of function ?.yInt_FromLong?
src/hash_template.c:356: warning: implicit declaration of function ?.yDict_SetItemString?
src/hash_template.c:356: warning: implicit declaration of function ?.yModule_GetDict?
src/hash_template.c:356: warning: implicit declaration of function ?.y_DECREF?
src/hash_template.c:360: warning: implicit declaration of function ?.yErr_Occurred?
src/hash_template.c:361: warning: implicit declaration of function ?.y_FatalError?
error: command 'gcc' failed with exit status 1

         报错截图如下:
20160109145701465.jpg

解决方案:
主要是缺少依赖包 python-dev 20160109145744577.jpg

yum -y install python-devel 进行yum安装此包即可
1.2 导入paramiko模块报错         在进行导入paramiko模块的时候,报错如下:
python>>import paramiko
(Crypto error: ‘module’ object has no attribute‘HAVE_DECL_MPZ_POWM_SEC’
解决方案:
找到/usr/lib/python2.7/site-packages/Crypto/Util/number.py
把if_fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
注释
#if_fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
在64位的操作系统中,路径如下所示:

修改之前的内容:
20160109145828484.jpg

1.3 安装ansible的时候报错
安装ansible的时候报错如下:
root@ansibleserver ansible-1.7.2]# python setup.py install
Ansible now needs setuptools in order to build. Install it using your package manager (usually python-setuptools) or via pip (pip install setuptools).
查看之后是需要安装setuptools,安装了setuptools工具即可。



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-291132-1-1.html 上篇帖子: Centos7编译安装ansible 下篇帖子: ansible palybook基础学习
累计签到:1 天
连续签到:1 天
发表于 2016-12-2 10:51:08 | 显示全部楼层
你好,楼主。我这里出现一个问题。就是你帖子的最后一处,我已经安装了setuptools,但在安装ansible的时候 还是报这个问题。请问要如何解决呢

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表