community.general.openbsd_pkg (8.5.0) — module

Manage packages on OpenBSD

Authors: Patrik Lundin (@eest)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage packages on OpenBSD using the pkg tools.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure nmap is installed
  community.general.openbsd_pkg:
    name: nmap
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure nmap is the latest version
  community.general.openbsd_pkg:
    name: nmap
    state: latest
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure nmap is not installed
  community.general.openbsd_pkg:
    name: nmap
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure nmap is installed, build it from source if it is not
  community.general.openbsd_pkg:
    name: nmap
    state: present
    build: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Specify a pkg flavour with '--'
  community.general.openbsd_pkg:
    name: vim--no_x11
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Specify the default flavour to avoid ambiguity errors
  community.general.openbsd_pkg:
    name: vim--
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Specify a package branch (requires at least OpenBSD 6.0)
  community.general.openbsd_pkg:
    name: python%3.5
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update all packages on the system
  community.general.openbsd_pkg:
    name: '*'
    state: latest
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Purge a package and it's configuration files
  community.general.openbsd_pkg:
    name: mpd
    clean: true
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Quickly remove a package without checking checksums
  community.general.openbsd_pkg:
    name: qt5
    quick: true
    state: absent

Inputs

    
name:
    description:
    - A name or a list of names of the packages.
    elements: str
    required: true
    type: list

build:
    default: false
    description:
    - Build the package from source instead of downloading and installing a binary. Requires
      that the port source tree is already installed. Automatically builds and installs
      the 'sqlports' package, if it is not already installed.
    - Mutually exclusive with O(snapshot).
    type: bool

clean:
    default: false
    description:
    - When updating or removing packages, delete the extra configuration file(s) in the
      old packages which are annotated with @extra in the packaging-list.
    type: bool

quick:
    default: false
    description:
    - Replace or delete packages quickly; do not bother with checksums before removing
      normal files.
    type: bool

state:
    choices:
    - absent
    - latest
    - present
    - installed
    - removed
    default: present
    description:
    - V(present) will make sure the package is installed.
    - V(latest) will make sure the latest version of the package is installed.
    - V(absent) will make sure the specified package is not installed.
    type: str

snapshot:
    default: false
    description:
    - Force C(%c) and C(%m) to expand to C(snapshots), even on a release kernel.
    - Mutually exclusive with O(build).
    type: bool
    version_added: 1.3.0
    version_added_collection: community.general

ports_dir:
    default: /usr/ports
    description:
    - When used in combination with the O(build) option, allows overriding the default
      ports source directory.
    type: path