community.openwrt.opkg module – Manage packages with opkg on OpenWrt

Note

This module is part of the community.openwrt collection (version 0.5.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.openwrt.

To use it in a playbook, specify: community.openwrt.opkg.

Synopsis

  • The community.openwrt.opkg module manages packages on OpenWrt using the opkg package manager.

  • It can install, remove, and update packages.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

autoremove

boolean

Remove dependencies that are no longer required when removing a package.

Choices:

  • false

  • true

force

string

Force option to pass to opkg.

Choices:

  • "depends"

  • "maintainer"

  • "reinstall"

  • "overwrite"

  • "downgrade"

  • "space"

  • "postinstall"

  • "remove"

  • "checksum"

  • "removal-of-dependent-packages"

name

aliases: pkg

string / required

Name of the package(s) to install or remove.

Multiple packages can be specified as a comma-separated list.

nodeps

boolean

Do not follow dependencies.

Choices:

  • false

  • true

state

string

Whether the package should be installed or removed.

Choices:

  • "absent"

  • "installed"

  • "present" ← (default)

  • "removed"

update_cache

boolean

Update the package cache (opkg update) before performing the operation.

Choices:

  • false

  • true

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Returns details on what has changed (or possibly needs changing in check_mode), when in diff mode.

platform

Platform: OpenWrt

Target platform for this module.

Examples

- name: Install a package
  community.openwrt.opkg:
    name: vim
    state: present

- name: Remove a package
  community.openwrt.opkg:
    name: vim
    state: absent

- name: Install multiple packages
  community.openwrt.opkg:
    name: vim,curl,wget
    state: present

- name: Update cache and install package
  community.openwrt.opkg:
    name: nginx
    state: present
    update_cache: true

- name: Force reinstall a package
  community.openwrt.opkg:
    name: busybox
    state: present
    force: reinstall

Authors

  • Markus Weippert (@gekmihesg)