community.general.openbsd_pkg 模块 – 在 OpenBSD 上管理软件包
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible 包,则您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用: ansible-galaxy collection install community.general。
要在剧本中使用它,请指定: community.general.openbsd_pkg。
概要
- 使用 pkg 工具在 OpenBSD 上管理软件包。 
参数
| 参数 | 注释 | 
|---|---|
| 从源代码构建软件包,而不是下载并安装二进制文件。需要已经安装端口源代码树。如果尚未安装,则会自动构建和安装“sqlports”软件包。 与  选项 
 | |
| 更新或删除软件包时,删除旧软件包中用 @extra 在打包列表中标注的额外配置文件。 选项 
 | |
| 软件包的名称或名称列表。 | |
| 与  默认值:  | |
| 快速替换或删除软件包;在删除普通文件之前不要费心检查校验和。 选项 
 | |
| 
 
 
 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在  | |
| 支持:部分支持 在 community.general 9.1.0 中添加 仅在未启用检查模式时才有效。 | 处于差异模式时,将返回有关已更改内容(或可能需要在  | 
备注
注意
- 与 - loop:一起使用时,每个软件包将被单独处理,直接将列表传递给- name选项效率更高。
示例
- name: Make sure nmap is installed
  community.general.openbsd_pkg:
    name: nmap
    state: present
- name: Make sure nmap is the latest version
  community.general.openbsd_pkg:
    name: nmap
    state: latest
- name: Make sure nmap is not installed
  community.general.openbsd_pkg:
    name: nmap
    state: absent
- name: Make sure nmap is installed, build it from source if it is not
  community.general.openbsd_pkg:
    name: nmap
    state: present
    build: true
- name: Specify a pkg flavour with '--'
  community.general.openbsd_pkg:
    name: vim--no_x11
    state: present
- name: Specify the default flavour to avoid ambiguity errors
  community.general.openbsd_pkg:
    name: vim--
    state: present
- name: Specify a package branch (requires at least OpenBSD 6.0)
  community.general.openbsd_pkg:
    name: python%3.5
    state: present
- name: Update all packages on the system
  community.general.openbsd_pkg:
    name: '*'
    state: latest
- name: Purge a package and it's configuration files
  community.general.openbsd_pkg:
    name: mpd
    clean: true
    state: absent
- name: Quickly remove a package without checking checksums
  community.general.openbsd_pkg:
    name: qt5
    quick: true
    state: absent
