feat/ufw_implementation #2

Merged
Damien merged 3 commits from feat/ufw_implementation into main 2026-06-01 08:49:12 +00:00
Showing only changes of commit 38e73c9c96 - Show all commits

View File

@@ -1,3 +1,44 @@
---
# roles/ufw/tasks/main.yml
- name: Install UFW (Alpine)
community.general.apk:
name: ufw
state: present
update_cache: true
when: ansible_facts['os_family'] == "Alpine"
- name: Install UFW (Debian)
ansible.builtin.apt:
name: ufw
state: present
update_cache: true
when: ansible_facts['os_family'] == "Debian"
- name: Add UFW to default runlevel (Alpine)
ansible.builtin.command:
cmd: rc-update add ufw default
register: rc_update_result
changed_when: >-
'already' not in rc_update_result.stdout
and 'already' not in rc_update_result.stderr
failed_when: rc_update_result.rc != 0
when: ansible_facts['os_family'] == "Alpine"
- name: Set default incoming policy
community.general.ufw:
default: "{{ ufw_default_incoming_policy }}"
direction: incoming
- name: Set default outgoing policy
community.general.ufw:
default: "{{ ufw_default_outgoing_policy }}"
direction: outgoing
- name: Enable UFW
community.general.ufw:
state: enabled
- name: Allow all traffic on Tailscale interface - name: Allow all traffic on Tailscale interface
community.general.ufw: community.general.ufw:
rule: allow rule: allow