Files
Ansible-Minecraft-Server/roles/01-server_hardening/tasks/04-configure-firewall.yml
hcornet 9ea9ac7254
Some checks failed
Ansible Minecraft Server CI/CD / lint (push) Failing after 21s
Ansible Minecraft Server CI/CD / test (push) Has been skipped
Ansible Minecraft Server CI/CD / deploy (push) Has been skipped
check new version
2025-08-27 07:59:19 +02:00

27 lines
621 B
YAML

---
- name: Install UFW firewall
ansible.builtin.apt:
name: ufw
state: present
when: ansible_os_family == "Debian"
- name: Configure UFW defaults
community.general.ufw:
direction: "{{ item.direction }}"
policy: "{{ item.policy }}"
loop:
- { direction: 'incoming', policy: 'deny' }
- { direction: 'outgoing', policy: 'allow' }
notify: reload firewall
- name: Allow TCP ports
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
loop: "{{ firewall_allowed_tcp_ports }}"
notify: reload firewall
- name: Enable UFW
community.general.ufw:
state: enabled