community.general.pkgutil 模块 – Solaris 上的 OpenCSW 包管理

注意

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

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

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

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

概要

参数

参数

注释

force

布尔值

在 community.general 1.2.0 中添加

要允许更新过程将软件包降级为与存储库中存在的软件包匹配,请将此项设置为 true

这对于从测试回滚到稳定版本或类似操作很有用。

选项

  • false ← (默认)

  • true

name

别名: pkg

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

软件包的名称。

当使用 state=latest 时,它可以是 '*',它会更新所有由 pkgutil 管理的已安装软件包。

site

字符串

从中安装软件包的存储库路径。

其全局定义位于 /etc/opt/csw/pkgutil.conf 中。

state

字符串 / 必需

是安装 (present/installed) 还是删除 (absent/removed) 软件包。

升级 (latest) 操作会将软件包更新/安装到可用的最新版本。

选项

  • "absent"

  • "installed"

  • "latest"

  • "present"

  • "removed"

update_catalog

布尔值

如果您始终希望从镜像刷新目录,即使目录不是过期的,也请将此项设置为 true

选项

  • false ← (默认)

  • true

属性

属性

支持

描述

check_mode

支持: 完全

为了检查软件包的可用性,即使在检查模式下,也可以刷新 /var/opt/csw/pkgutil 下的目录缓存。

可以在 check_mode 中运行并返回已更改状态预测,而无需修改目标。

diff_mode

支持:

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

示例

- name: Install a package
  community.general.pkgutil:
    name: CSWcommon
    state: present

- name: Install a package from a specific repository
  community.general.pkgutil:
    name: CSWnrpe
    site: ftp://myinternal.repo/opencsw/kiel
    state: latest

- name: Remove a package
  community.general.pkgutil:
    name: CSWtop
    state: absent

- name: Install several packages
  community.general.pkgutil:
    name:
    - CSWsudo
    - CSWtop
    state: present

- name: Update all packages
  community.general.pkgutil:
    name: '*'
    state: latest

- name: Update all packages and force versions to match latest in catalog
  community.general.pkgutil:
    name: '*'
    state: latest
    force: true

作者

  • Alexander Winkler (@dermute)

  • David Ponessa (@scathatheworm)