community.general.rpm_ostree_pkg 模块 – 安装或卸载附加覆盖包

注意

此模块是 community.general 集合 (版本 10.1.0) 的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.general

要在 playbook 中使用它,请指定:community.general.rpm_ostree_pkg

community.general 2.0.0 中的新增功能

概要

  • 使用 rpm-ostree 命令安装或卸载附加覆盖包。

参数

参数

注释

apply_live

布尔值

在 community.general 10.1.0 中添加

state=present 时,添加选项 --apply-live

state=absent 时,忽略此选项。

更多信息,请参见 https://coreos.github.io/rpm-ostree/apply-live/

选项

  • false ← (默认)

  • true

name

别名:pkg

列表 / 元素=字符串 / 必需

要安装或删除的覆盖包的名称。

state

字符串

覆盖包的状态。

present 只确保安装所需的包。

absent 删除指定的包。

选项

  • "absent"

  • "present" ← (默认)

属性

属性

支持

描述

check_mode

支持:不支持

可以在 check_mode 中运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:不支持

在差异模式下,将返回有关已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息。

示例

- name: Install overlay package
  community.general.rpm_ostree_pkg:
    name: nfs-utils
    state: present

- name: Remove overlay package
  community.general.rpm_ostree_pkg:
    name: nfs-utils
    state: absent

- name: Apply the overlay package live
  community.general.rpm_ostree:
    name: nfs-utils
    state: present
    apply_live: true

# In case a different transaction is currently running the module would fail.
# Adding a delay can help mitigate this problem:
- name: Install overlay package
  community.general.rpm_ostree_pkg:
    name: nfs-utils
    state: present
  register: rpm_ostree_pkg
  until: rpm_ostree_pkg is not failed
  retries: 10
  dealy: 30

返回值

常用返回值已在此处记录,以下是此模块特有的字段

描述

action

字符串

执行的操作。

返回:始终

示例:"install"

changed

布尔值

状态更改。

返回:始终

示例:true

cmd

字符串

用于执行操作的完整命令。

返回:始终

示例:"rpm-ostree uninstall --allow-inactive --idempotent --unchanged-exit-77 nfs-utils"

needs_reboot

布尔值

在 community.general 10.1.0 中添加

确定机器是否需要重新启动才能应用当前更改。

返回:成功

示例:true

packages

列表 / 元素=字符串

指定的包列表。

返回:始终

示例:["nfs-utils"]

rc

整数

rpm-ostree 命令的返回代码。

返回:始终

示例:0

stderr

字符串

rpm-ostree 命令的标准错误输出。

返回:始终

示例:""

stdout

字符串

rpm-ostree 命令的标准输出。

返回:始终

示例:"Staging deployment...done\\n..."

作者

  • Dusty Mabe (@dustymabe)

  • Abhijeet Kasurde (@Akasurde)