码迷,mamicode.com
首页 > 其他好文 > 详细

实战ansible批量安装定制好的rpm包

时间:2015-07-23 00:54:42      阅读:590      评论:0      收藏:0      [点我收藏+]

标签:ansible install rpm

1、项目背景

        公司最近在生产环境上线内网dns服务器,开源组件选的是powerdns。其中客户端要安装powerdns-recursor,那么疑问来了,线上有100多台server,如何高效快速安装,就得我们运维考虑啦。由于线上之前有部署ansible来批量管理服务器,于是我这的方案就是ansible+定制好的rmp包powerdns-recursor+ansible-doc yum模块。

2、构建本地yum仓库

        因为我没找到ansible安装rpm包的模块,所有只能用yum模块,因此先要构造本地yum仓库,详细参考我的另外一篇博客http://hanyun.blog.51cto.com/1060170/1660078

3、构建定制rpm包,后面找时间补上这块的内容

4、前3步准备好以后,接下来安装就很容易。

ansible ttp_www -m yum -a ‘name=http://172.16.1.211:81/powerdns-recursor-3.7.3-0.el6.x86_64.rpm state=installed‘ --sudo
x.x.x.x | success >> {
    "changed": true,
    "msg": "",
    "rc": 0,
    "results": [
        "Loaded plugins: downloadonly, fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirrors.zju.edu.cn\n * epel: ftp.cuhk.edu.hk\n * extras: mirrors.163.com\n * updates: mirrors.zju.edu.cn\nSetting up Install Process\nExamining /var/tmp/yum-root-Chl1dY/powerdns-recursor-3.7.3-0.el6.x86_64.rpm: powerdns-recursor-3.7.3-0.el6.x86_64\nMarking /var/tmp/yum-root-Chl1dY/powerdns-recursor-3.7.3-0.el6.x86_64.rpm to be installed\nResolving Dependencies\n--> Running transaction check\n---> Package powerdns-recursor.x86_64 0:3.7.3-0.el6 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package         Arch   Version     Repository                             Size\n================================================================================\nInstalling:\n powerdns-recursor\n                 x86_64 3.7.3-0.el6 /powerdns-recursor-3.7.3-0.el6.x86_64 9.8 M\n\nTransaction Summary\n================================================================================\nInstall       1 Package(s)\n\nTotal size: 9.8 M\nInstalled size: 9.8 M\nDownloading Packages:\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n\r  Installing : powerdns-recursor-3.7.3-0.el6.x86_64                         1/1 \n\r  Verifying  : powerdns-recursor-3.7.3-0.el6.x86_64                         1/1 \n\nInstalled:\n  powerdns-recursor.x86_64 0:3.7.3-0.el6                                        \n\nComplete!\n"
    ]
}

x.x.x.x | success >> {
    "changed": true,
    "msg": "http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/6/x86_64/repodata/1391f50a2eef61cff2d1b2f05609edfb43368031e4a19ddf85bddda5847df910-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 7 - \"couldn‘t connect to host\"\nTrying other mirror.\n",
    "rc": 0,
    "results": [
        "Loaded plugins: downloadonly, fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirrors.pubyun.com\n * epel: ftp.cuhk.edu.hk\n * extras: mirrors.pubyun.com\n * updates: centos.ustc.edu.cn\nSetting up Install Process\nExamining /var/tmp/yum-root-4imk7e/powerdns-recursor-3.7.3-0.el6.x86_64.rpm: powerdns-recursor-3.7.3-0.el6.x86_64\nMarking /var/tmp/yum-root-4imk7e/powerdns-recursor-3.7.3-0.el6.x86_64.rpm to be installed\nResolving Dependencies\n--> Running transaction check\n---> Package powerdns-recursor.x86_64 0:3.7.3-0.el6 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package         Arch   Version     Repository                             Size\n================================================================================\nInstalling:\n powerdns-recursor\n                 x86_64 3.7.3-0.el6 /powerdns-recursor-3.7.3-0.el6.x86_64 9.8 M\n\nTransaction Summary\n================================================================================\nInstall       1 Package(s)\n\nTotal size: 9.8 M\nInstalled size: 9.8 M\nDownloading Packages:\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n\r  Installing : powerdns-recursor-3.7.3-0.el6.x86_64                         1/1 \n\r  Verifying  : powerdns-recursor-3.7.3-0.el6.x86_64                         1/1 \n\nInstalled:\n  powerdns-recursor.x86_64 0:3.7.3-0.el6                                        \n\nComplete!\n"
    ]
}

本文出自 “hanyun.fang” 博客,转载请与作者联系!

实战ansible批量安装定制好的rpm包

标签:ansible install rpm

原文地址:http://hanyun.blog.51cto.com/1060170/1677220

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!