arillso.system.to_nftables_ports filter – Convert port list to nftables port syntax

Note

This filter plugin is part of the arillso.system collection (version 1.0.5).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install arillso.system.

To use it in a playbook, specify: arillso.system.to_nftables_ports.

New in arillso.system 1.0.0

Synopsis

  • Converts port numbers, ranges, and lists into proper nftables syntax.

  • Handles single ports, port ranges, and port sets correctly.

Keyword parameters

This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | arillso.system.to_nftables_ports(key1=value1, key2=value2, ...)

Parameter

Comments

port_value

any / required

Port number, range, or list to format

Examples

# Single port
{{ 80 | arillso.system.to_nftables_ports }}
# Output: 80

# Port list
{{ [80, 443, 8080] | arillso.system.to_nftables_ports }}
# Output: { 80, 443, 8080 }

# Port range
{{ '1000-2000' | arillso.system.to_nftables_ports }}
# Output: 1000-2000

Return Value

Key

Description

Return value

string

Formatted port specification for nftables

Returned: success

Authors

  • arillso