aboutsummaryrefslogtreecommitdiffstats
path: root/roles/pf
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-15 17:26:32 +0100
committerbinary <me@rgoncalves.se>2020-11-15 17:26:32 +0100
commitaea6b114e050545ccc8b953c579d53c9158e238b (patch)
tree7cbeb2ad790638e433c21f1452dded1588949d2e /roles/pf
parent5bcecbf08db7013ba4de12e492961e2cba6e6b8a (diff)
downloadinfrastructure-aea6b114e050545ccc8b953c579d53c9158e238b.tar.gz
I'm so lazy so ignore this cimment this time pls
Diffstat (limited to 'roles/pf')
-rw-r--r--roles/pf/tasks/main.yml8
-rw-r--r--roles/pf/templates/pf.conf.j212
2 files changed, 12 insertions, 8 deletions
diff --git a/roles/pf/tasks/main.yml b/roles/pf/tasks/main.yml
index 51471c5..c48c728 100644
--- a/roles/pf/tasks/main.yml
+++ b/roles/pf/tasks/main.yml
@@ -24,11 +24,3 @@
delay: 2
state: started
-- name: Add cron job for pf
- cron:
- cron_file: /etc/crontab
- name: "Reload pf configuration"
- user: root
- job: "/sbin/pfctl -f /etc/pf.conf > /dev/nul 2>&1"
- minute: "*"
-
diff --git a/roles/pf/templates/pf.conf.j2 b/roles/pf/templates/pf.conf.j2
index 6d67f4f..42b0bea 100644
--- a/roles/pf/templates/pf.conf.j2
+++ b/roles/pf/templates/pf.conf.j2
@@ -16,6 +16,18 @@ block all
pass in quick on egress proto {{ service["proto"] }} to port {{ service["port"] }}
{% endfor %}
+# redirection
+{% for h in groups["all"] %}
+{% set h = hostvars[h] %}
+{##}
+{% if h.services is defined %}
+{% for service in h.services if h.ansible_host != "dcontroller" and service.public is defined and service.public%}
+pass in on egress proto { {{ service.proto }} } from any to any port {{ service.port }} rdr-to {{ h.ip.in }}
+{% endfor %}
+{% endif %}
+{##}
+{% endfor %}
+
# *
# sub-config. by Ansible
# *
remember that computers suck.