diff --git a/playbooks/utils/ufw_firewall.yml b/playbooks/utils/ufw_firewall.yml index d0d0abc125..ea621faf0c 100644 --- a/playbooks/utils/ufw_firewall.yml +++ b/playbooks/utils/ufw_firewall.yml @@ -8,6 +8,8 @@ become: true vars: running_on_server: true + vars_files: + - ../../group_vars/all/vars.yml pre_tasks: - name: stop playbook if you didn't pass --limit diff --git a/roles/ufw_firewall/vars/main.yml b/roles/ufw_firewall/vars/main.yml index 00391dd1a9..99bf6f39ed 100644 --- a/roles/ufw_firewall/vars/main.yml +++ b/roles/ufw_firewall/vars/main.yml @@ -1,2 +1,8 @@ --- # vars file for roles/ufw_firewall +ufw_firewall_rules: > + {%- set rules = [] -%} + {%- for network in ufw_campus_and_vpn -%} + {{ rules.append({'protocol': 'tcp', 'source': network, 'port': 22, 'action': 'ACCEPT'}) }} + {%- endfor -%} + {{ rules }}