openbsd_pkg - Manage packages on OpenBSD.


Manage packages on OpenBSD using the pkg tools.

Requirements (on host that executes module)

  • python >= 2.5


parameter required default choices comments
(added in 2.1)
  • 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.
Name of the package.
(added in 2.1)
no /usr/ports
When used in combination with the 'build' option, allows overriding the default ports source directory.
  • 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.


# 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

This is an Extras Module

For more information on what this means please read Extras Modules

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

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.