ansible.builtin.dpkg_selections 模块 – Dpkg 包选择设置

注意

此模块是 ansible-core 的一部分,包含在所有 Ansible 安装中。在大多数情况下,您甚至可以不指定 集合关键字 就使用简短的模块名称 dpkg_selections。但是,我们建议您使用 完全限定集合名称 (FQCN) ansible.builtin.dpkg_selections,以便轻松链接到模块文档并避免与可能具有相同模块名称的其他集合冲突。

概述

  • 通过 --get-selections--set-selections 更改 dpkg 包选择状态。

参数

参数

注释

name

字符串 / 必需

包的名称。

selection

字符串 / 必需

要将包设置为的选择状态。

选项

  • "安装"

  • "保留"

  • "卸载"

  • "清除"

属性

属性

支持

描述

check_mode

支持: 完全支持

可以在 check_mode 下运行并返回更改状态预测,而不会修改目标,如果不受支持,则操作将被跳过。

diff_mode

支持: 完全支持

当处于 diff 模式时,将返回有关已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息。

platform

平台: debian

可以针对其进行操作的目标操作系统/系列。

注意

注意

  • 此模块不会导致任何包被安装/删除/清除,请使用 ansible.builtin.apt 模块来完成此操作。

示例

- name: Prevent python from being upgraded
  ansible.builtin.dpkg_selections:
    name: python
    selection: hold

- name: Allow python to be upgraded
  ansible.builtin.dpkg_selections:
    name: python
    selection: install

作者

  • Brian Brazil (@brian-brazil)