Files

16 lines
855 B
Django/Jinja
Raw Permalink Normal View History

2026-10-02 21:34:01 +04:00
#jinja2: trim_blocks: True, lstrip_blocks: True
{% for item in nft_managed_group | sort %}
{% set client = hostvars[item] %}
{% if 'nft_input' in client and client.nft_input is not none %}
{% set rules = client.nft_input if (client.nft_input is iterable and client.nft_input is not string) else [client.nft_input] %}
{% for rule in rules %}
{% set protos = rule.proto if (rule.proto is iterable and rule.proto is not string) else [rule.proto | default(none)] %}
{% set ports = rule.port if (rule.port is iterable and rule.port is not string) else [rule.port | default(none)] %}
{% for proto in protos %}
{% for port in ports %}
iifname "{{ client.iface }}" ip saddr {{ client.ip }} {% if proto and port %}{{ proto }} dport {{ port }} {% endif %}counter accept comment "{{ item }} -> router"
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}