mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-04-24 14:13:19 +02:00
16 lines
675 B
YAML
16 lines
675 B
YAML
![]() |
---
|
||
|
|
||
|
- name: Handle nomad ports in the firewall
|
||
|
iptables_raw:
|
||
|
name: nomad_port_{{ item }}
|
||
|
state: "{{ (('tcp' in nomad_services[item].proto or 'udp' in nomad_services[item].proto) and nomad_services[item].src_ip | length > 0) | ternary('present', 'absent') }}"
|
||
|
rules: |
|
||
|
{% if 'tcp' in nomad_services[item].proto %}
|
||
|
-A INPUT -m state --state NEW -p tcp --dport {{ nomad_services[item].port }} -j ACCEPT
|
||
|
{% endif %}
|
||
|
{% if 'udp' in nomad_services[item].proto %}
|
||
|
-A INPUT -m state --state NEW -p udp --dport {{ nomad_services[item].port }} -j ACCEPT
|
||
|
{% endif %}
|
||
|
loop: "{{ nomad_services.keys() | list }}"
|
||
|
tags: firewall,nomad
|