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 ...
随机推荐
- UITableView的使用及性能优化
UITableView可谓是日常开发中最重要的控件之一,而使用UITableView最重要的在于性能优化.iOS设备的内存有限,如果用UITableView显示成千上万条数据,就需要成千上万个UITa ...
- flex 4 transition
<s:transitions> <s:Transition fromState="default"> <s:Parallel> <mx:R ...
- HttpClient 4.x 执行网站登录并抓取网页的代码
HttpClient 4.x 的 API 变化还是很大,这段代码可用来执行登录过程,并抓取网页. HttpClient API 文档(4.0.x), HttpCore API 文档(4.1) pack ...
- 苹果开发者账号注册&真机调试
苹果公司开发者账号注册流程详解 http://www.cnblogs.com/xilinch/p/4037164.html 真机调试教程 http://segmentfault.com/a/11900 ...
- Makefile简介
1.源程序的编译在Linux下面,如果要编译一个C语言源程序,我们要使用GNU的gcc编译器. 下面我们以一个实例来说明如何使用gcc编译器.假设我们有下面一个非常简单的源程序(hello.c):in ...
- 单点登录系统构建之二——SSO原理及CAS架构
基本概念 SSO(Single Sign On)单点登录,是在多个应用系统中,用户只需要登录一次就能访问所有相互信任的应用系统.它包括将这次的主要登录映射到其他应用中用户同一个用户的登录机制. SSO ...
- R语言缺失值信息处理
mean(!is.na(mat))可以计算数据完整度(没有缺失值的) mean(!is.na(mat))>0.9,90%完整可以使用 # 缺失值的位置研究as.vector(attributes ...
- HTTP全部报文首部字段
总结了一下HTTP各种报文首部字段. HTTP报文类型与结构 HTTP报文结构 报文首部 空行(CR+LF) 报文主体 HTTP报文类型 http有两种类型报文,请求报文和响应报文两种报文的首部结构如 ...
- MySQL "replace into" 的坑
MySQL 对 SQL 有很多扩展,有些用起来很方便,但有一些被误用之后会有性能问题,还会有一些意料之外的副作用,比如 REPLACE INTO. 比如有这样一张表: CREATE TABLE `au ...
- BZOJ 1911 特别行动队
另一个版本的斜率优化...这个要好理解一些. #include<iostream> #include<cstdio> #include<cstring> #incl ...