-
Notifications
You must be signed in to change notification settings - Fork 18
/
tasks_ufw.yml
42 lines (36 loc) · 1.1 KB
/
tasks_ufw.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- # https://github.com/StarterSquad/prudentia/blob/master/prudentia/tasks/ufw.yml
# Parameters:
# ufw_rules_default (provided)
# ufw_rules_allow (provided)
# ufw_rules_allow_from_hosts (optional)
- debug: var="ufw_rules_allow"
- name: UFW | Reset it
ufw: state=reset
become: yes
tags:
- ufw
- name: UFW | Configure incoming/outgoing defaults
ufw: policy={{item.policy}} direction={{item.direction}}
with_items: ufw_rules_default
become: yes
tags:
- ufw
- name: UFW | Configure rules to allow incoming traffic
ufw: rule=allow port={{item.port}} proto={{item.proto}}
with_items: ufw_rules_allow
when: ufw_rules_allow is defined
become: yes
tags:
- ufw
- name: UFW | Configure rules to allow incoming traffic from specific hosts
ufw: rule=allow port={{item.port}} proto={{item.proto}} src={{ item.address }}
with_items: ufw_rules_allow_from_hosts
when: ufw_rules_allow_from_hosts is defined
become: yes
tags:
- ufw
- name: UFW | Enable it
ufw: state=enabled logging=on
become: yes
tags:
- ufw