Fix templating bug in iptables_state tests (#11541)

* Fix templating bug in iptables_state tests.

* Try to install older packages on RHEL.
This commit is contained in:
Felix Fontein
2026-03-11 22:02:08 +01:00
committed by GitHub
parent 9b72d95452
commit 4cd91ba4d4
2 changed files with 11 additions and 2 deletions

View File

@@ -8,12 +8,21 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: ensure iptables package is installed
- name: ensure iptables package is installed (non-RHEL)
package:
name:
- iptables
become: true
when: not (ansible_facts.distribution == 'RedHat' and ansible_facts.distribution_major_version|int >= 10)
- name: ensure iptables package is installed (RHEL 10+)
package:
name:
- "kernel-modules-extra-matched-{{ ansible_facts.kernel }}"
- "iptables-nft"
- "kernel-modules-extra-{{ ansible_facts.kernel }}"
become: true
when: ansible_facts.distribution == 'RedHat' and ansible_facts.distribution_major_version|int >= 10
- name: include tasks
vars:

View File

@@ -272,7 +272,7 @@
assert:
that:
- iptables_state is failed
- "iptables_state.msg == 'Table mangle to restore not defined in {{ iptables_tests }}'"
- "iptables_state.msg == ('Table mangle to restore not defined in ' ~ iptables_tests)"
success_msg: >-
The previous error has been triggered by trying to restore a table
that is missing in the file provided to iptables-restore.