mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-06 16:46:54 +02:00
Update to 2022-07-21 01:00
This commit is contained in:
15
roles/consul/tasks/iptables.yml
Normal file
15
roles/consul/tasks/iptables.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- name: Handle consul ports in the firewall
|
||||
iptables_raw:
|
||||
name: consul_port_{{ item }}
|
||||
state: "{{ (('tcp' in consul_services[item].proto or 'udp' in consul_services[item].proto) and consul_services[item].src_ip | length > 0) | ternary('present', 'absent') }}"
|
||||
rules: |
|
||||
{% if 'tcp' in consul_services[item].proto %}
|
||||
-A INPUT -m state --state NEW -p tcp --dport {{ consul_services[item].port }} -j ACCEPT
|
||||
{% endif %}
|
||||
{% if 'udp' in consul_services[item].proto %}
|
||||
-A INPUT -m state --state NEW -p udp --dport {{ consul_services[item].port }} -j ACCEPT
|
||||
{% endif %}
|
||||
loop: "{{ consul_services.keys() | list }}"
|
||||
tags: firewall,consul
|
Reference in New Issue
Block a user