~craftyguy/ansible-nftables

3ee933ab9343d722daf1c989732b305a405ebef7 — Clayton Craft 5 months ago 3043da9 master
include rule desc as "comment" in actual rule

Helps with reviewing the generated configuration
1 files changed, 3 insertions(+), 2 deletions(-)

M templates/etc/nftables.conf
M templates/etc/nftables.conf => templates/etc/nftables.conf +3 -2
@@ 21,11 21,12 @@ table {{ table.family }} {{ table.name }} {
        policy {{ chain.default_policy | default('drop' ) }};
{%      if chain.rules is defined %}
{%      for rule in chain.rules %}
{%      set stmt=rule.statement %}
{%      if rule.desc is defined %}

{%      set stmt=stmt+" comment \""+rule.desc+"\"" %}
        {{ '# ' + rule.desc }}
{%      endif %}
        {{ rule.matches | join(' ') }} {{ rule.statement }}
        {{ rule.matches | join(' ') }} {{ stmt }}
{%      endfor %}
{%      endif %}
    }