--- - name: UFW Konfiguration hosts: all become: true tasks: - name: Setze Standard UFW Regel auf deny community.general.ufw: state: enabled default: deny - name: Erlaube SSH Zugriff von spezifischen IPs community.general.ufw: rule: allow src: "{{ item }}" proto: tcp to_port: "22" loop: "{{ ssh_ips }}" - name: Erlaube spezifizierte TCP Ports community.general.ufw: rule: allow to_port: "{{ item }}" proto: tcp loop: "{{ tcp_ports }}" - name: Erlaube spezifizierte UDP Ports community.general.ufw: rule: allow to_port: "{{ item }}" proto: udp loop: "{{ udp_ports }}" - name: Aktiviere UFW community.general.ufw: state: enabled default: deny direction: incoming