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

1、查看python版本

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

2、安装ansible

2.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 安装ansible

https://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 安装setuptools

https://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、拷贝配置文件

在安装完成之后,配置文件在安装路径之中,如下图所示:

将配置文件拷贝过去:

4、初步进行测试

进行一个简单的测试看是否安装成功:

从而安装完成

问题

1.1安装pycryto模块报错

在安装pycryto米快的时候进行解压安装如下:

[root@ansibleserver ansible]# cd pycrypto-2.6.1

[root@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

报错截图如下:

解决方案:

主要是缺少依赖包 python-dev

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位的操作系统中,路径如下所示:

修改之前的内容:

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工具即可。

ansible安装及问题解决的更多相关文章

  1. mysql 7下载安装及问题解决

    mysql 7安装及问题解决 一.mysql下载 下载地址:https://www.mysql.com/downloads/ Community (GPL) Downloads MySQL Commu ...

  2. 初探ansible安装

    一.ansible介绍常用的自动化运维工具 Puppet —基于 Ruby 开发,采用 C/S 架构,扩展性强,基于 SSL,远程命令执行相对较弱SaltStack —基于 Python 开发,采用 ...

  3. Ansible安装配置Nginx

    一.思路 现在一台机器上编译安装好nginx.打包,然后在用ansible去下发 cd /etc/ansible 进入ansible配置文件目录 mkdir roles/{common,install ...

  4. Ansible安装配置及使用

    一.Ansible特点 1.不需要安装客户端,通过sshd通信 2.基于模块工作,模块可以由任何序言开发 3.不仅支持命令行使用模块,也支持编写yaml格式的playbook 4.支持sudo 5.有 ...

  5. Ansible安装配置

    Ansible工具的安装与配置 Ansible基于SSH,不需要在远程端安装任何软件,只需要在管理端安装ansible及其组件即可. Ansible使用前提是已配置ssh密钥免登陆. 一.安装组件: ...

  6. ansible安装二进制kubernetes-1.14.1

    主机信息: 主机IP 主机名 角色 10.10.3.181 k8s-m1  kube-apiserver,kube-controller-manager,kube-scheduler,etcd 10. ...

  7. Ansible安装部署以及常用模块详解

    一.  Ansible 介绍Ansible是一个配置管理系统configuration management system, python 语言是运维人员必须会的语言, ansible 是一个基于py ...

  8. 内网环境使用ansible安装software 需要外网时,如何绑定代理呢

    内网环境使用ansible安装software 需要外网时,如何绑定代理呢? 方法一: 在ansible 的脚本里,yum install 的地方,添加语句: environment: https_p ...

  9. Ansible 安装与配置(一)

    公司大概有200多云主机需要进行管理,但是如果通过手工管理费时还累最终结果也容易出错,所以考虑通过自动化的方式来管理云主机,目前开源的自动化工具,大家用的比较多的有Ansible和Saltstack这 ...

随机推荐

  1. Android SQLite数据库增删改查操作

    一.使用嵌入式关系型SQLite数据库存储数据 在Android平台上,集成了一个嵌入式关系型数据库——SQLite,SQLite3支持NULL.INTEGER.REAL(浮点数字). TEXT(字符 ...

  2. MySQL 数据库性能优化之索引优化

    接着上一篇 MySQL 数据库性能优化之表结构,这是 MySQL数据库性能优化专题 系列的第三篇文章:MySQL 数据库性能优化之索引优化 大家都知道索引对于数据访问的性能有非常关键的作用,都知道索引 ...

  3. slot signal机制

    有一个比较 经典的实现:http://sigslot.sourceforge.net/很精简的 signal slot的实现,跨平台.webrtc项目在用,我在自己项目里也用了.这个源码有2000多行 ...

  4. SQLServer2008 行转列2

    with a as ( select numb,name,row_number() over( partition by numb order by name desc) rowid from fen ...

  5. 详解javascript中的call, apply

    一些学js的同学一看到call, apply, 就蒙了, 感觉不好懂, 看的头大. 今天我们就一起来研究一下这2个东东.彻底弄清楚它们的用法. 定义: call, apply是函数的方法, 只有函数才 ...

  6. 【笨嘴拙舌WINDOWS】GDI映射方式

    TextOut(hdc,100,100,TEXT(“Love China”),10) 这句GDI函数的作用是在坐标点(100,100)的位置输出一个“Love China”字符串: GDI函数作为硬件 ...

  7. VMware11安装Mac OS X10提示不可恢复错误解决

    VMware11安装Mac OS X10提示不可恢复错误(vcpu-0)怎么办?本文将详细介绍如何解决VMware11安装Mac OS X10提示不可恢复错误. 工具/原料   VMware11 PC ...

  8. Kafka中的Message Delivary机制

    学习Kafka的读书笔记,暂未把文章设为翻译类型,因为并非直译文档.水平有限,还请路过高手指正. <1> “最多(发送)一次”(At most once):消息可以丢失但绝不会重新发送:& ...

  9. A1377. 楼房重建

    题目:http://www.tsinsen.com/A1377 题解:分块大法好.每块维护一个有序表,修改暴力修改,查询从前往后跳即可. 代码: #include<cstdio> #inc ...

  10. Hadoop实战课程

    Hadoop生态系统配置Hadoop运行环境Hadoop系统架构HDFS分布式文件系统MapReduce分布式计算(MapReduce项目实战)使用脚本语言Pig(Pig项目实战)数据仓库工具Hive ...