ansible.builtin.openbsd_pkg (v2.9.27) — module

Manage packages on OpenBSD

| "added in version" 1.1 of ansible.builtin"

Authors: Patrik Lundin (@eest)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manage packages on OpenBSD using the pkg tools.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure nmap is installed
  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
  openbsd_pkg:
    name: nmap
    state: latest
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure nmap is not installed
  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
  openbsd_pkg:
    name: nmap
    state: present
    build: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Specify a pkg flavour with '--'
  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
  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)
  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
  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
  openbsd_pkg:
    name: mpd
    clean: yes
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Quickly remove a package without checking checksums
  openbsd_pkg:
    name: qt5
    quick: yes
    state: absent

Inputs

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

build:
    default: 'no'
    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.
    type: bool
    version_added: '2.1'
    version_added_collection: ansible.builtin

clean:
    default: 'no'
    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
    version_added: '2.3'
    version_added_collection: ansible.builtin

quick:
    default: 'no'
    description:
    - Replace or delete packages quickly; do not bother with checksums before removing
      normal files.
    type: bool
    version_added: '2.3'
    version_added_collection: ansible.builtin

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

ports_dir:
    default: /usr/ports
    description:
    - When used in combination with the C(build) option, allows overriding the default
      ports source directory.
    version_added: '2.1'
    version_added_collection: ansible.builtin