|
| 1 | +# Copyright (c) 2026, Alexei Znamensky (@russoz) |
| 2 | +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 3 | +# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | + |
| 5 | +- name: Remove package manager |
| 6 | + hosts: all |
| 7 | + gather_facts: false |
| 8 | + tasks: |
| 9 | + - name: Block for init role (ssh failure) |
| 10 | + block: |
| 11 | + - name: Invoke init role |
| 12 | + ansible.builtin.include_role: |
| 13 | + name: community.openwrt.init |
| 14 | + vars: |
| 15 | + ansible_host: 192.168.255.255 |
| 16 | + openwrt_install_recommended_packages: false |
| 17 | + rescue: |
| 18 | + - name: Assert role fails |
| 19 | + ansible.builtin.assert: |
| 20 | + that: |
| 21 | + - ansible_failed_result is failed |
| 22 | + - >- |
| 23 | + 'Could not find package manager:' in ansible_failed_result.msg |
| 24 | +
|
| 25 | + - name: Remove package managers |
| 26 | + community.openwrt.command: |
| 27 | + cmd: mv /bin/opkg /bin/opkg.orig || mv /usr/bin/apk /usr/bin/apk.orig |
| 28 | + uses_shell: true |
| 29 | + |
| 30 | + - name: Block for init role (package manager is not there) |
| 31 | + block: |
| 32 | + - name: Invoke init role |
| 33 | + ansible.builtin.include_role: |
| 34 | + name: community.openwrt.init |
| 35 | + vars: |
| 36 | + openwrt_install_recommended_packages: false |
| 37 | + rescue: |
| 38 | + - name: Assert role fails |
| 39 | + ansible.builtin.assert: |
| 40 | + that: |
| 41 | + - ansible_failed_result is failed |
| 42 | + - >- |
| 43 | + 'Could not find package manager:' in ansible_failed_result.msg |
0 commit comments