Package

STATE: stable

TESTS: Playbook

API Docs: Core - Firmware

Service Docs: Plugins

Info

If:

  • the package cache is too old, it will take some time - as OPNSense automatically checks for updates beforehand

  • the target firewall runs an outdated version, the actions ‘install’ and ‘reinstall’ will fail as OPNSense prevents it

Be aware that the list-module with target ‘package’ will return installed plugins AND base-packages.

Definition

Definition

Parameter

Type

Required

Default

Aliases

Comment

name

list of strings

true

-

Package or list of packages to process

action

string

true

-

Action to execute. One of: ‘install’, ‘reinstall’, ‘remove’, ‘lock’, ‘unlock’

post_sleep

int

false

3

Seconds to sleep after executing the action. The firewall needs some time to update package info.

timeout

float

false

30.0

Seconds until the action request times-out

For basic parameters see: Basic

Examples

- hosts: localhost
  gather_facts: no
  module_defaults:
    group/ansibleguy.opnsense.all:
      firewall: 'opnsense.template.ansibleguy.net'
      api_credential_file: '/home/guy/.secret/opn.key'

    ansibleguy.opnsense.list:
      target: 'package'

  tasks:
    - name: Installing
      ansibleguy.opnsense.package:
        name: 'os-api-backup'
        action: 'install'

    - name: Installing - multiple packages at once
      ansibleguy.opnsense.package:
        name: ['os-api-backup', 'os-dmidecode']
        action: 'install'

    - name: Removing
      ansibleguy.opnsense.package:
        name: 'os-api-backup'
        action: 'remove'

    - name: Re-installing
      ansibleguy.opnsense.package:
        name: 'os-api-backup'
        action: 'reinstall'

    - name: Locking
      ansibleguy.opnsense.package:
        name: 'os-api-backup'
        action: 'lock'

    - name: Unlocking
      ansibleguy.opnsense.package:
        name: 'os-api-backup'
        action: 'unlock'

    - name: Listing
      ansibleguy.opnsense.list:
      #  target: 'package'
      register: existing_entries

    - name: Printing installed packages
      ansible.builtin.debug:
        var: existing_entries.data