Add nft_custom_includes option for optional includes in the main filter table.

This commit is contained in:
Philipp Rintz 2021-03-03 10:40:24 +01:00
parent e9a83261fa
commit 3be5c95180
No known key found for this signature in database
GPG Key ID: BE0205E9A286FF24
2 changed files with 14 additions and 0 deletions

View File

@ -102,6 +102,11 @@ nft_global_host_rules: {}
# Custom content (tables, include,…) to add in Nftables configuration. # Custom content (tables, include,…) to add in Nftables configuration.
nft__custom_content: '' nft__custom_content: ''
# ]]] # ]]]
# .. envvar:: nft_custom_includes [[[
#
# Custom includes to add into the main Nftables filter configuration.
nft_custom_includes: ''
# ]]]
# .. envvar:: nft_conf_dir_path [[[ # .. envvar:: nft_conf_dir_path [[[
# #
# Path to the sub directory for Nftables configuration files. # Path to the sub directory for Nftables configuration files.

View File

@ -29,6 +29,15 @@ table inet filter {
include "{{ nft_set_conf_path }}" include "{{ nft_set_conf_path }}"
include "{{ nft_input_conf_path }}" include "{{ nft_input_conf_path }}"
include "{{ nft_output_conf_path }}" include "{{ nft_output_conf_path }}"
{% if nft_custom_includes | default() %}
{% if nft_custom_includes is string %}
include "{{ nft_custom_includes }}"
{% elif nft_custom_includes is iterable and (nft_custom_includes is not string and nft_custom_includes is not mapping) %}
{% for include in nft_custom_includes %}
include "{{ include }}"
{% endfor %}
{% endif %}
{% endif %}
} }
{% if nft__nat_table_manage %} {% if nft__nat_table_manage %}