community.openwrt.apk_feed module – Manage apk package feeds

Note

This module is part of the community.openwrt collection (version 1.11.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.apk_feed.

New in community.openwrt 1.10.0

Synopsis

  • Add or remove a package feed in the repositories files read by apk, and optionally the key the feed is signed with.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

file

string

Repositories file holding the feed. It is created when needed.

The default file is the one OpenWrt keeps across a system upgrade.

Default: "/etc/apk/repositories.d/customfeeds.list"

key

string

PEM encoded public key the feed is signed with, written to key_name in /etc/apk/keys/.

Only used when state=present.

key and key_url are mutually exclusive.

key_name

string

Name of the key file in /etc/apk/keys/.

Required when key or key_url is given.

When state=absent, the key file is removed along with the feed.

key_url

string

URL of the PEM encoded public key the feed is signed with, downloaded by the device to key_name in /etc/apk/keys/.

The key is downloaded on every run, check mode included, to compare it with the one in place.

Only used when state=present.

key and key_url are mutually exclusive.

state

string

Whether the feed should be present or not.

Choices:

  • "absent"

  • "present" ← (default)

tag

string

Tag of the feed. apk only installs packages from a tagged feed when they are requested as name@tag.

When the feed is already present with another tag, or without one, its line is rewritten.

update_cache

boolean

Update the package index with apk update when the module changes something.

Choices:

  • false ← (default)

  • true

url

string / required

URL of the feed.

A feed is identified by its URL, whatever its tag.

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.

Notes

Note

  • This module requires apk, the package manager of OpenWrt 25.12 and later.

  • Keys in /etc/apk/keys/ are not kept across a system upgrade unless listed in /etc/sysupgrade.conf.

See Also

See also

community.openwrt.apk

Manage packages with apk on OpenWrt.

Examples

- name: Add a third-party feed along with its signing key
  community.openwrt.apk_feed:
    url: https://m00qek.github.io/packages.ucode.dev/25.12
    key_url: https://m00qek.github.io/packages.ucode.dev/25.12/feed.pub.pem
    key_name: packages.ucode.dev.pem
    update_cache: true

- name: Add a tagged feed in a file of its own
  community.openwrt.apk_feed:
    url: https://example.com/openwrt/packages.adb
    tag: example
    file: /etc/apk/repositories.d/example.list

- name: Remove the feed and its signing key
  community.openwrt.apk_feed:
    url: https://m00qek.github.io/packages.ucode.dev/25.12
    key_name: packages.ucode.dev.pem
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

file

string

Repositories file holding the feed.

Returned: always

Sample: "/etc/apk/repositories.d/customfeeds.list"

key_file

string

Path of the key file.

Returned: When key_name is given

Sample: "/etc/apk/keys/packages.ucode.dev.pem"

state

string

Whether the feed is present or not.

Returned: always

Sample: "present"

tag

string

Tag of the feed.

Returned: always

Sample: "ucodedev"

url

string

URL of the feed.

Returned: always

Sample: "https://m00qek.github.io/packages.ucode.dev/25.12"

Authors

  • Alexei Znamensky (@russoz)