概述
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