anible包模块管理
ansible使用包管理模块
一般使用的包管理模块的RPM,和YUM
|
参数 |
必填 |
默认 |
选择 |
说明 |
|
Conf_file |
No |
YUM的配置文件 |
||
|
Disable_dbg_check |
No |
No |
Yes/no |
是否开启验证 |
|
Disablerepo |
No |
禁用的仓库 |
||
|
Enablerepo |
No |
启用的仓库 |
||
|
List |
No |
非幂等性命令 |
||
|
Name |
Yes |
包名称 |
||
|
State |
No |
Present |
Present/installed Latest/absent Removed |
是否插入(present,installed,latest),移除 (absent/removed)包 |
1.1 安装最新的包
|
[root@ansibleserver tmp]# ansible pythonserver -m yum -a "name=httpd state=latest" SSH password: 192.168.1.60 | success >> { "changed": true, "msg": "", "rc": 0, "results": [ "Loaded plugins: product-id, security, subscription-manager\nUpdating certificate-based repositories.\nSetting up Install Process\nResolving Dependencies\n--> Running transaction check\n---> Package httpd.x86_64 0:2.2.15-15.el6 will be installed\n--> ] } |
查询之后发现已经安装,并且安装了最新版本
name表示需要安装的包名称,state为lastest,表示安装Apache的最新版本
1.2 移除包
|
[root@ansibleserver tmp]# ansible pythonserver -m yum -a "name=httpd state=absent" SSH password: 192.168.1.60 | success >> { "changed": true, "msg": "", "rc": 0, "results": [ "Loaded plugins: product-id, security, subscription-manager\nUpdating certificate-based repositories.\nSetting up Remove Process\nResolving Dependencies\n--> Running transaction check\n---> Package httpd.x86_64 0:2.2.15-15.el6 will be erased\n--> ] } |
移除安装包
1.3 指定repo来进行安装包
|
[root@ansibleserver tmp]# ansible pythonserver -m yum -a "name=httpd enablerepo=rhel state=present" SSH password: 192.168.1.60 | FAILED >> { "failed": true, "msg": "Error setting/accessing repo rhel: Error getting repository data for rhel, repository not found" } |
在指定源的时候,使用enablerepo,注意这个名字是配置文件/etc/yum.repo.d/目录中文件的section的名称,如下所示:
|
[root@ansibleserver yum.repos.d]# cat rhel-source.repo |grep kel [kel] name=kel baseurl=file:///tmp/kel |
主要的就是使用这个repo的名字,section为[kel]
在上面的报错信息中,主要就是没有找到这个section
|
[root@ansibleserver ~]# ansible pythonserver -m yum -a "name=httpd enablerepo=kel state=present" SSH password: 192.168.1.60 | success >> { "changed": true, "msg": "", "rc": 0, "results": [ "Loaded plugins: product-id, security, subscription-manager\nUpdating certificate-based repositories.\nSetting up Install Process\nResolving Dependencies\n--> Running transaction check\n---> Package httpd.x86_64 0:2.2.15-15.el6 will be installed\n--> ] } |
在上面例子中,可以看到直接进行了安装
1.4 指定版本进行安装包
|
[root@ansibleserver ~]# ansible pythonserver -m yum -a "name=httpd-2.2.15-15.el6.x86_64 state=present " SSH password: 192.168.1.60 | success >> { "changed": true, "msg": "", "rc": 0, "results": [ "Loaded plugins: product-id, security, subscription-manager\nUpdating certificate-based repositories.\nSetting up Install Process\nResolving Dependencies\n--> Running transaction check\n---> Package httpd.x86_64 0:2.2.15-15.el6 will be installed\n--> ] } |
在进行name指定版本的时候,架构类型可以写也可以不写,也就是x86_64可以写或者不写都是可以的
在写上版本的时候,注意是l还是1,注意具体的版本型号,在实验的时候因为字母l和数字1导致很多时间被浪费,指定的具体版本无法进行安装
1.5 更新所有安装包
|
[root@ansibleserver ~]# ansible pythonserver -m yum -a "name=* state=latest" |
1.6 指定rpm进行安装
|
[root@ansibleserver ~]# ansible pythonserver -m yum -a "name=/usr/local/src/kel.noarch.rpm state=present" |
表示直接指定了一个rpm的位置,然后进行直接安装rpm
1.7 指定远程网址rpm进行安装
|
ansible pythonserver -m yum -a "name=http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6.0.el6.ngx.noarch.rpm state=present" |
直接指定一个远程网址来进行安装包
anible包模块管理的更多相关文章
- day17跨文件夹导入模块,模块的两种被执行方式,包,直接使用包中模块,包的管理
复习 ''' 1.模块 -- 一系列功能的集合体,用文件来管理一系列有联系的功能,该文件我们称之为模块,文件名就是模块名 -- import | from...import 来导入模块,从而使用模块中 ...
- Python科学计算包模块的安装(ubuntu)
Python的科学计算包设计到C语言代码的编译,采用pip的方式安装会出现错误. 一种简单的方式是采用的集成包,具体的步骤参考:https://www.continuum.io/downloads#_ ...
- [20150522]RPM包的管理
RPM包的管理 RPM包的分类 RPM包可分为源码包和二进制包两类.源码包的主要优点是开源,如果有足够的能力,可以修改源代码,源码包可以自由选择所需要安装的功能,软件是编译安装,所以更加适合自己的系统 ...
- Webpack: 为Web开发而生的模块管理器[转]
Webpack: 为Web开发而生的模块管理器 原文地址:http://hanjianwei.com/2014/09/10/webpack-package-manager-for-web/ 10 Se ...
- npm模块管理器入门
什么是 NPM npm 是 Node 官方提供的包管理工具,他已经成了 Node 包的标准发布平台,用于 Node 包的发布.传播.依赖控制.npm 提供了命令行工具,使你可以方便地下载.安装.升级. ...
- Perl模块管理
Perl模块管理 perl有自带的模块,还有第三方模块.自带的模块是随perl安装而安装好的,第三方模块需要从CPAN(Comprehensive Perl Archive Network)上下载并安 ...
- [Web 前端] 使用yarn代替npm作为node.js的模块管理器
cp from : https://www.jianshu.com/p/bfe96f89da0e Fast, reliable, and secure dependency managemen ...
- 每天记录一点:NetCore获得配置文件 appsettings.json vue-router页面传值及接收值 详解webpack + vue + node 打造单页面(入门篇) 30分钟手把手教你学webpack实战 vue.js+webpack模块管理及组件开发
每天记录一点:NetCore获得配置文件 appsettings.json 用NetCore做项目如果用EF ORM在网上有很多的配置连接字符串,读取以及使用方法 由于很多朋友用的其他ORM如S ...
- 使用yarn代替npm作为node.js的模块管理器
使用yarn代替npm作为node.js的模块管理器 转 https://www.jianshu.com/p/bfe96f89da0e Fast, reliable, and secure d ...
随机推荐
- 文件夹属性中只有"常规"解决办法
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers] [HK ...
- myeclipse 2016 激活,myeclipse 2016 激活
myeclipse 2016 激活: 找了好久,myeclipse 2016 终于激活了.myeclipse版本是下载的 myeclipse-2016-ci-0-offline-installer- ...
- 【图像算法】图像特征:GLCM灰度共生矩阵,纹理特征
[图像算法]图像特征:GLCM SkySeraph Aug 27th 2011 HQU Email:zgzhaobo@gmail.com QQ:452728574 Latest Modifie ...
- win8.1下解决Visual C++不兼容的方法
1.下载visual c++的安装包 百度云下载地址为:http://pan.baidu.com/s/1c0dRAYs 2.修改MSDEV.EXE文件名 安装完成后在安装目录下找到MSDEV.EXE, ...
- dojo 十 ajax dojo/_base/xhr
官方教程:Ajax with DojoAjax功能:1.从服务器加载静态数据2.从web服务中访问xml或json类型的数据3.将表单(form)数据发送到服务器4.刷新页面内容....Ajax在RI ...
- 将Android Studio工程导入到Eclipse中
1.前言 studio项目中src/main/java目录里面的代码对应的是eclispe项目中的src目录中的代码. 而studio中src目录里面包括整个项目的所有代码包括资源文件和xml. 2. ...
- MTK6577+Android环境变量
1. 环境变量机器对应的路径 $project = hsimobile77_ics2 $platform=mt6577 $(PRODUCT_OUT)=\out\target\product\$proj ...
- 使用SqlTransaction回滚事务
https://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqltransaction(v=vs.110).aspx private ...
- Spring 运用 pointcut 和 advisor 对特定的方法进行切面编程
上一个例子演示了对特定的bean中的所有的方法进行面向切面编程,包括了 before , after , after throwing, around 几种形式: 如果想对一个bean中的特定方法进行 ...
- js方式进行地理位置的定位api搜集
新浪 //int.dpool.sina.com.cn/iplookup/iplookup.php?format=js //int.dpool.sina.com.cn/iplookup/iplookup ...