需求描述:

  管理具有特征性的集群服务器,50台左右,服务都是规划好的!为了更加有效地管理服务器,需要引入协助管理员关系的工具!ansible基于ssh通信不需要安装agent(agentless),使用简单!

  有需求,动力就会诞生!为了更好地服务自己及他人,分享知识中的点点滴滴!

搭建环境:

Linux: Centos6.5x64

python:python2.6+

ansible: 2.6.3

相关资源:

libsodium-1.0.16.tar.gz

https://pan.baidu.com/s/10nwgFipRbxF5yoDpYiqGtg 密码: 9w9i

ansible2.6.3

https://pan.baidu.com/s/1ZwzdkuhVvjhzgp9gbJZLTw 密码: 4mjq

01、下载ansible

https://releases.ansible.com/ansible/ansible-2.6.3.tar.gz   //发行

https://releases.ansible.com/ansible/rpm/release/epel-6-x86_64/ansible-2.6.3-1.el6.ans.noarch.rpm  //rpm

02、下载依赖

https://pypi.org/     //官方库根据名字自己搜索,注意对python版本的依赖

https://pan.baidu.com/s/1ZwzdkuhVvjhzgp9gbJZLTw 密码: 4mjq    //已经下载好的!

03、安装依赖

 #yum安装

yum install -y python python-setuptools gcc gcc-c++ python-devel  openssl-devel libffi-devel

 #源码安装libsodium

https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz
./configure
make 
make install

/etc/ld.so.conf.d/libsodium.conf   //添加到系统环境动态库
/usr/local/lib/

ldconfig      
ldconfig  -v |grep local  //查看是否加载

 #脚本自动安装

#!/bin/bash
#desc: auto setup ansible
#centos6.5+python2.6+ansible2.6.x #解压
ls *.tar.gz |xargs -n1 tar zxf cd MarkupSafe*
python setup.py install
cd .. cd Jinja2*
python setup.py install
cd .. cd PyYAML*
python setup.py install
cd .. cd pyasn1*
python setup.py install
cd .. cd pycparser*
python setup.py install
cd .. cd cffi*
python setup.py install
cd .. cd six*
python setup.py install
cd .. cd PyNaCl*
python setup.py install
cd .. cd ipaddress*
python setup.py install
cd .. cd enum34*
python setup.py install
cd .. cd asn1crypto*
python setup.py install
cd .. cd idna*
python setup.py install
cd .. cd cryptography*
python setup.py install
cd .. cd bcrypt*
python setup.py install
cd .. cd ordereddict*
python setup.py install
cd ..

#安装parmiko
cd paramiko*
python setup.py install
cd ..

#安装ansible
cd ansible*
python setup.py install
cd .. echo "all is ok"

注意:注意安装中的报错要处理下!我测试没有问题的。。。

04、配置文件

find / -name ansible.cfg 2>/dev/null   //查找ansible.cfg主配置

mkdir -p /etc/ansible/
cp /root/ansible-2.6.3/examples/ansible.cfg /etc/ansible

host_key_checking = False  //对ansible.cfg的knows检测取消

05、测试

 #测试ssh主机是否可用

[root@lab-110 ansible]# ansible local -m ping -k    //-k 对root密码验证
SSH password:
172.24.0.110 | SUCCESS => {
"changed": false,
"ping": "pong"
}

#免密码通讯

ssh-keygen -t rsa    //在control机器上生成密钥对  id_rsa  私钥   id_rsa.pub 公钥

利用ansible的authorized_key模块对远程主机分发公钥实现免密码登录

[root@lab-110 ansible]# ansible local -m authorized_key -a "user=root key='{{ lookup('file','/root/.ssh/id_rsa.pub') }}
'" -kSSH password:
172.24.0.110 | SUCCESS => {
"changed": true,
"comment": null,
"exclusive": false,
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAs81XUJHkBhwoAKU62ngLiGrR9yhLLAPPkNbnMYLnpwXXAqQFv8wcuZw4Q6C17bnHW+77XAk
/TOyWJhZ9yHEjs80louqtZlf4s/t2wwLjCTYLLVnxPcS0KgwSvRnah+w9z0wAy0VU5QwNH4W3ukUnVCHTVI8FhWwm8tssTD+APJ1HMeum/EATIa5eNw8TEtYFOYTKtDbnXQe7BWFKrblwALQwLxaaEASFLAVv5V5BOVhFLxCIi969pQ9G46ij9jyLo7Md8Zm1ggS3zQZL9oH5WVP5pyDEjXHTCopEgp3VIirNfDRI+RDU98+BlLk8T65Z9QFM8Kf0kHw928BETmiEiw== root@lab-110", "key_options": null,
"keyfile": "/root/.ssh/authorized_keys",
"manage_dir": true,
"path": null,
"state": "present",
"unique": false,
"user": "root",
"validate_certs": true
}
[root@lab-110 ansible]# ansible all -m ping
172.24.0.110 | SUCCESS => {
"changed": false,
"ping": "pong"
}

Centos6.5安装ansible2.6.3的更多相关文章

  1. vmware Centos6.6安装64位

    Centos6.6安装64位 必须开启BIOS中的虚拟化技术 首先开机进入BIOS,一般机器是按F2,我的T420是按F1,然后进入Security,Virtualization,选择Enable即可 ...

  2. Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】

    摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ...

  3. CentOS6.5安装Tomcat

    安装说明 安装环境:CentOS-6.4 安装方式:源码安装 软件:apache-tomcat-7.0.56.tar.gz 下载地址:http://tomcat.apache.org/download ...

  4. Centos6 yum安装openldap+phpldapadmin+TLS+双主配置

    原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ...

  5. centos6.5安装oracle11g_2

    centos7安装oracle数据库不成功,换成centos6.5安装,可以安装成功,记录一下 安装系统时,主机名如果不是用localhost,安装成功后,要用主机名和ip做映射,修改/etc/hos ...

  6. CentOS6.6安装vmware workstation报错

    本人系统用的是centos6.6,安装了vmware workstation,启动后一直如下图报错,相关内核已经安装了的,哪位前辈如果解决过这样的问题,麻烦指点指点,小弟在此先谢过了.

  7. CentOS6.6安装virtualbox4.1.44

    本人用的是centos6.6,安装了virtualbox 4.1.44,启动后一直如上图报错,哪位前辈如果解决过这样的问题,麻烦指点指点,小弟在此先谢过了.

  8. [转]CentOS-6.3安装配置cmake

    CentOS-6.3安装配置cmake   zhoulf 2013-02-03 原创 安装说明 安装环境:CentOS-6.3安装方式:源码编译安装 软件:cmake-2.8.10.2.tar.gz下 ...

  9. 实战CENTOS6.5安装docker并创建asp.net mvc 5 镜像,运行MVC 网站

    Docker,容器,让研发.测试.生产同一环境,可在linux平台上混合使用JAVA与net 程序 Centos6.5安装docker 参考http://my.oschina.net/kcw/blog ...

随机推荐

  1. SpringBoot 使用Swagger2打造在线接口文档(附汉化教程)

    原文地址: https://www.jianshu.com/p/7e543f0f0bd8 SpringBoot + Swagger2 UI界面-汉化教程 1.默认的英文界面UI 想必很多小伙伴都曾经使 ...

  2. B. Random Teams(Codeforces Round 273)

    B. Random Teams time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  3. SQL Server 数据库项目

    ylbtech-.NET Framework: SQL Server 数据库项目 SQL Server 数据库项目 类型:SQL Server 用于创建 SQL Server 数据库的项目 1. 新建 ...

  4. Identifier:GUID (全局唯一标识符)

    ylbtech-Miscellaneos-Identifier:GUID (全局唯一标识符) A,返回顶部 1, 全局唯一标识符(GUID,Globally Unique Identifier)是一种 ...

  5. rapidjson库的基本使用

    转自:https://blog.csdn.net/qq849635649/article/details/52678822 我在工作中一直使用的是rapidjson库,这是我在工作中使用该库作的一些整 ...

  6. Asp.net WebAPI Request参数验证-请不要重复造轮子

    随着web客户端的发展,现在很多公司都有专业的前端开发,做到系统前后端分离.ap.net后端典型的就是采用webapi,但是发现很多时候大家对webapi并不了解,这里我们来说说输入参数的验证.前一段 ...

  7. Eclipse系列:如何设置Eclipse关联JDK源码和文档

    一.设置Eclipse关联JDK源码 1.打开Eclipse-->Windows-->Preferences       2. 在弹出的Preferences对话框中,Java--> ...

  8. 如何把本地代码提交到git(码云)、github代码管理项目上

    前提必须安装了git工具 以下命令操作都是通过git bash操作. 将本地代码提交到码云空项目操作: D:\>mkdir inek_winprop D:\>cd inek_winprop ...

  9. C# Winform 未能加载文件或程序集"System.Data.SQLite"或它的某一个依赖项。试图加载格式不正确的程序

    在使用Winform 开发了一个小软件,其中使用了SQLite作为数据库 但在我的Win7 64位系统上却出现了以下错误: System.BadImageFormatException: 未能加载文件 ...

  10. 转:android root tcpdump抓包强烈推荐

    转:http://www.cnblogs.com/findyou/p/3491035.html 写的相当详细且完整,业界良心. adb push d:\tcpdump /data/local/ adb ...