ansible dnf模块详解

概述

Installs, upgrade, removes, and lists packages and groups with the `dnf’ package manager
通过dnf管理数据包,比如安装、更新、卸载和查看数据包

常用模块

name : A package name or package specifier with version, like `name-1.0’. When using state=latest, this can be '’ which means run: dnf -y update. You can also pass a url or a local path to a rpm file.To operate on several packages this can accept a comma separated string of packages or a list of packages.
(Aliases: pkg)
指定需要安装的数据包名称,星号
代表所有数据包

state:Whether to install (present’, latest’), or remove (absent’) a package.Default is None’, however in effect the default action is present’ unless the autoremove’ option is enabled for this module, then absent’ is inferred.
(Choices: absent, present, installed, removed, latest)[Default: (null)]
指定软件包的状态,installed、present和latest代表安装,remove和absent代表删除

disable_gpg_check :Whether to disable the GPG checking of signatures of packages being installed. Has an effect only if state is present’ or latest’.
[Default: no]
type: bool
用于禁用对 rpm 包的公钥 gpg 验证

enablerepo : `Repoid’ of repositories to enable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a “,”.
[Default: (null)]
指定安装软件包时临时启用的 yum 源

disablerepo : `Repoid’ of repositories to disable for the install/update operation. These repos will not persistbeyond the transaction. When specifying multiple repos, separate them with a “,”.
指定安装软件包时临时禁用的 yum 源

示例

案例1&#x

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值