community.general.apt_rpm 模块 – APT-RPM 包管理器
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.general.apt_rpm
。
概要
使用
apt-rpm
管理软件包。需要低级 (rpm
) 和高级 (apt-get
) 软件包管理器二进制文件。
要求
执行此模块的主机需要以下要求。
rpm
python 包(rpm 绑定),可选。如果package
选项包含本地文件,则需要此包。
参数
参数 |
注释 |
---|---|
运行等效于 可以作为软件包安装的一部分运行(clean 在安装之前运行)或作为单独的步骤运行。 选项
|
|
如果为 true,则执行 选项
|
|
要安装、升级或删除的软件包列表。 从 community.general 8.0.0 开始,如果 |
|
指示所需的软件包状态。 请注意,目前 状态 选项
|
|
在操作之前运行等效于 默认是不更新缓存。 选项
|
|
如果为 true,则执行 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:不支持 |
可以在 |
|
支持:不支持 |
处于 diff 模式时,将返回有关已更改内容(或可能需要在 |
示例
- name: Install package foo
community.general.apt_rpm:
pkg: foo
state: present
- name: Install packages foo and bar
community.general.apt_rpm:
pkg:
- foo
- bar
state: present
- name: Remove package foo
community.general.apt_rpm:
pkg: foo
state: absent
- name: Remove packages foo and bar
community.general.apt_rpm:
pkg: foo,bar
state: absent
# bar will be the updated if a newer version exists
- name: Update the package database and install bar
community.general.apt_rpm:
name: bar
state: present
update_cache: true
- name: Run the equivalent of "apt-get clean" as a separate step
community.general.apt_rpm:
clean: true
- name: Perform cache update and complete system upgrade (includes kernel)
community.general.apt_rpm:
update_cache: true
dist_upgrade: true
update_kernel: true