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) 包管理器二进制文件。
要求
执行此模块的主机需要以下要求。
- rpmpython 包(rpm 绑定),可选。 如果- package选项包含本地文件,则为必需。
参数
| 参数 | 注释 | 
|---|---|
| 运行等效于  可以作为软件包安装的一部分运行(清除在安装之前运行),也可以作为单独的步骤运行。 选项 
 | |
| 如果为 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
