{% set combined_defines = [ nftables_builtin_defines, nftables_defines ] | combine %} {% set combined_sets = [ nftables_builtin_sets, nftables_sets ] | combine %} {% set combined_input_rules = [ nftables_input_builtin_rules, nftables_input_rules ] | combine %} {% set combined_forward_rules = [ nftables_forward_builtin_rules, nftables_forward_rules ] | combine %} {% set combined_output_rules = [ nftables_output_builtin_rules, nftables_output_rules ] | combine %} table inet filter { {% for name, cfg in combined_defines.items() %} {% if cfg is string or cfg is number %} define {{ name }} = {{ cfg }} {% elif cfg is sequence %} define {{ name }} = { {% for elem in cfg %} {{ elem }}, {% endfor %} } {% endif %} {% endfor %} {% for name, cfg in combined_sets.items() %} set {{ name }} { {% for elem in cfg %} {{ elem }} {% endfor %} } {% endfor %} chain input { {% for comment, rules in combined_input_rules.items() %} # {{ comment }} {% for rule in rules %} {{ rule }} {% endfor %} {% endfor %} } chain forward { {% for comment, rules in combined_forward_rules.items() %} # {{ comment }} {% for rule in rules %} {{ rule }} {% endfor %} {% endfor %} } chain output { {% for comment, rules in combined_output_rules.items() %} # {{ comment }} {% for rule in rules %} {{ rule }} {% endfor %} {% endfor %} } }