community.general.pkgng 模块 – FreeBSD >= 9.0 的软件包管理器
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。
要在 playbook 中使用它,请指定:community.general.pkgng。
概要
- 使用 ‘pkgng’ 管理 FreeBSD 的二进制软件包,该软件包在 9.0 之后的版本中可用。 
参数
| 参数 | 注释 | 
|---|---|
| 形式为  | |
| 删除不再需要的自动安装的软件包。 选项 
 | |
| 使用本地软件包库,而不是获取更新的软件包库。 选项 
 | |
| 忽略 FreeBSD 操作系统版本检查,在 -STABLE 和 -CURRENT 分支上很有用。 定义  选项 
 | |
| 要安装/删除的软件包的名称或名称列表。 使用  | |
| 对于 1.1.4 之前的 pkgng 版本,指定用于下载软件包的 packagesite。如果未指定,则使用  对于较新的 pkgng 版本,指定在  | |
| 软件包的状态。 选项 
 | |
| 将软件包名称视为 shell glob 模式。 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持: 完全 | 可以在  | |
| 支持: 无 | 在 diff 模式下,将返回有关已更改(或可能需要在  | 
注意事项
注意
- 当使用 pkgsite 时,请注意已在缓存中的软件包不会再次下载。 
- 当与 - loop:一起使用时,每个软件包都将单独处理,将列表直接传递给- name选项效率更高。
示例
- name: Install package foo
  community.general.pkgng:
    name: foo
    state: present
- name: Annotate package foo and bar
  community.general.pkgng:
    name:
      - foo
      - bar
    annotation: '+test1=baz,-test2,:test3=foobar'
- name: Remove packages foo and bar
  community.general.pkgng:
    name:
      - foo
      - bar
    state: absent
- name: Upgrade package baz
  community.general.pkgng:
    name: baz
    state: latest
- name: Upgrade all installed packages (see warning for the name option first!)
  community.general.pkgng:
    name: "*"
    state: latest
- name: Upgrade foo/bar
  community.general.pkgng:
    name: foo/bar
    state: latest
    use_globs: false
