Files
ntbops-ansible/roles/ufw/tasks/main.yml
T

41 lines
799 B
YAML

---
- name: Install UFW
ansible.builtin.apt:
name: ufw
state: present
tags: [ufw]
- name: Set incoming policy
community.general.ufw:
direction: incoming
policy: "{{ ufw_default_incoming_policy }}"
tags: [ufw, firewall]
- name: Set outgoing policy
community.general.ufw:
direction: outgoing
policy: "{{ ufw_default_outgoing_policy }}"
tags: [ufw, firewall]
- name: Allow TCP ports
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
loop: "{{ ufw_tcp_ports }}"
tags: [ufw, firewall]
- name: Allow UDP ports
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: udp
loop: "{{ ufw_udp_ports }}"
tags: [ufw, firewall]
- name: Enable UFW
community.general.ufw:
state: enabled
tags: [ufw, firewall]