Documentation

openbsd_pkg - Manage packages on OpenBSD.

Synopsis

  • Manage packages on OpenBSD using the pkg tools.

Options

parameter required default choices comments
build
(added in 2.1)
no
  • True
  • False
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.
clean
(added in 2.3)
no
  • True
  • False
When updating or removing packages, delete the extra configuration file(s) in the old packages which are annotated with @extra in the packaging-list.
name
yes
Name of the package.
ports_dir
(added in 2.1)
no /usr/ports
When used in combination with the 'build' option, allows overriding the default ports source directory.
quick
(added in 2.3)
no
  • True
  • False
Replace or delete packages quickly; do not bother with checksums before removing normal files.
state
yes
  • present
  • latest
  • absent
present will make sure the package is installed. latest will make sure the latest version of the package is installed. absent will make sure the specified package is not installed.

Examples

# Make sure nmap is installed
- openbsd_pkg:
    name: nmap
    state: present

# Make sure nmap is the latest version
- openbsd_pkg:
    name: nmap
    state: latest

# Make sure nmap is not installed
- openbsd_pkg:
    name: nmap
    state: absent

# Make sure nmap is installed, build it from source if it is not
- openbsd_pkg:
    name: nmap
    state: present
    build: yes

# Specify a pkg flavour with '--'
- openbsd_pkg:
    name: vim--no_x11
    state: present

# Specify the default flavour to avoid ambiguity errors
- openbsd_pkg:
    name: vim--
    state: present

# Specify a package branch (requires at least OpenBSD 6.0)
- openbsd_pkg:
    name: python%3.5
    state: present

# Update all packages on the system
- openbsd_pkg:
    name: '*'
    state: latest

# Purge a package and it's configuration files
- openbsd_pkg: name=mpd clean=yes state=absent

# Quickly remove a package without checking checksums
- openbsd_pkg: name=qt5 quick=yes state=absent

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.