OpenWrt 25.x Package Manager changes
With OpenWrt 25.x the Package Manager changed from opkg to apk (apk is used in Alpine Linux).
The announcement was made here: <https://openwrt.org/releases/25.12/notes-25.12.0-rc1>.
Major changes can be found here: <https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet>
Playbooks supporting only apk
---
- hosts: routers
gather_facts: false
roles:
- community.openwrt.init
tasks:
- name: Gather OpenWrt facts
community.openwrt.setup:
# opkg will fail on OpenWrt 25.x or later
- name: Install a package
community.openwrt.apk:
name: luci
state: present
update_cache: true
Playbooks supporting both apk and legacy opkg
---
- hosts: routers
gather_facts: false
roles:
- community.openwrt.init
tasks:
- name: Install package
action: community.openwrt.{{ openwrt_package_manager }}
args:
name: luci
state: present
update_cache: true
- name: Remove package
action: community.openwrt.{{ openwrt_package_manager }}
args:
name: luci
state: absent