From 8ff8f1fa4037defebab29c7c7775ae3372cbe9a7 Mon Sep 17 00:00:00 2001 From: binary Date: Sat, 7 Nov 2020 20:39:07 +0100 Subject: Automate network deployment --- roles/pf/tasks/main.yml | 4 ++-- roles/pf/templates/pf.conf.j2 | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'roles/pf') diff --git a/roles/pf/tasks/main.yml b/roles/pf/tasks/main.yml index 7916c69..c47a721 100644 --- a/roles/pf/tasks/main.yml +++ b/roles/pf/tasks/main.yml @@ -3,12 +3,12 @@ --- -- name: Generate and sync configuration +- name: Generate pf configuration template: src: templates/pf.conf.j2 dest: /etc/pf.conf owner: root - group: "{{ group.root }}" + group: "{{ group_root }}" mode: "0600" - name: Restart pf diff --git a/roles/pf/templates/pf.conf.j2 b/roles/pf/templates/pf.conf.j2 index 64001cf..d39694d 100644 --- a/roles/pf/templates/pf.conf.j2 +++ b/roles/pf/templates/pf.conf.j2 @@ -13,18 +13,15 @@ set skip on { lo tun0 } block all -{% for key, value in services.tcp.items() %} -pass in quick on egress proto tcp to port {{ value }} -{% endfor %} -{% for key, value in services.udp.items() %} -pass in quick on egress proto udp to port {{ value }} +{% for service in services %} +pass in quick on egress proto {{ service["proto"] }} to port {{ service["port"] }} {% endfor %} # ====================== # # sub-config. by Ansible # ====================== # -{% include "templates/" + inventory_hostname + "/etc/pf.conf.j2" %} +{% include "templates/" + inventory_hostname + "/etc/pf.conf.j2" ignore missing %} # ========================= # # out. interface by Ansible -- cgit v1.2.3