ansible--03】的更多相关文章

主机清单 [webservers] ansible01 ansible02 ansible03 ansible04 [root@ftp:/root] > ansible webservers -u root -k -m ping -o SSH password: ansible03 | SUCCESS => {"changed": false, "ping": "pong"} ansible01 | SUCCESS => {&q…
ansible自动化运维常用模块 常用模块实现的功能:安装软件包:修改配置文件:创建程序用户组:创建目录,并修改所属和权限:挂载:启动服务:测试. command模块: shell模块: 注意:command和shell模块功能类似,均不支持别名(命令),区别:command只能使用一条指令,shell可以使用管道! 例子1: [root@host1 ~]# ansible test1 -m shell -a "df -h|grep /$" 192.168.132.163 | CHAN…
1.1 SaltStack.Ansible.Puppet比较 1.SaltStack 1. saltStack由Python编写,为server-client模式的系统,自己本身支持多master. 2. 运行模式为master端下发指令,客户端接收指令执行. 3. saltstack依赖于zeromq消息队列,采用yaml格式编写配置文件,比较简单. 4. 支持api及自定义python模块,能轻松实现功能扩展. 2.Ansible 1. 类似与saltstack,基于python开发,关注的…
最近在写一个批量巡检工具,利用ansible将脚本推到各个机器上执行,然后将执行的结果以json格式返回来. 如下所示: # ansible node2 -m script -a /root/python/health_check.py node2 | SUCCESS => { "changed": true, , "stderr": "Shared connection to 192.168.244.20 closed.\r\n", &q…
原文  http://dl528888.blog.51cto.com/2382721/1435415 我使用过puppet(地址是http://dl528888.blog.51cto.com/2382721/1040552)与salt(地址是http://dl528888.blog.51cto.com/2382721/1312503),但这2个软件都需要安装客户端,并且更新很快,每次更新都是令人蛋疼的事,尤其是salt,喜欢他的命令功能,但bug太多,不敢在公司线上使用,puppet虽然稳定,但…
ansible网络模块安装httplib2 在进行使用ansible的网络模块的时候,需要安装httplib2模块 下载地址: https://pypi.python.org/pypi?%3Aaction=search&term=httplib2&submit=search 下载之后进行解压: tar -zxvf httplib2-0.9.1.tar.gz 进行安装: [root@ansibleserver ~]# cd httplib2-0.9.1 [root@ansibleserver…
rpm安装 下载epl源 :  Download the latest epel-release rpm from:http://dl.fedoraproject.org/pub/epel/6/x86_64      执行 wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm  安装epel-release :    # rpm -Uvh epel-release*rpm    安装ansib…
自动化运维工具之ansible   一,ansible简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric)的优点,其批量系统配置.批量程序部署.批量运行命令等功能配置起来十分简单.ansible是基于模块工作的,本身没有批量部署的能力.真正具有批量部署的是ansible所运行的模块,ansible只是提供一种框架.主要包括: <code> (1).连接插件connection plugins:…
一.Ansible的安装 1.yum源安装 以centos为例,默认在源里没有ansible,不过在fedora epel源里有ansible,配置完epel 源后,可以直接通过yum 进行安装.这里以centos6.8为例: [root@MSJTVL-CSTX-A01 ~]# yum install http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm [root@MSJTVL-CSTX-A01 ~]#…
本文参考 <Ansible 自动化运维和最佳实践>,这两天刚读这本书,写写总结.主控机环境是 centos 7,被控机均是 centos 6.8 . 确保 python 版本大于 2.6 [root@localhost ~]# python Python 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2 Type "help", "copy…