---
- name: Install ufw
become: true
ansible.builtin.apt:
update_cache: true
pkg:
- ufw
- name: Set logging
community.general.ufw:
logging: "on"
- name: Allow port 22 and enable UFW
state: enabled
rule: allow
proto: tcp
port: "22"
- name: Enable and start ufw service
ansible.builtin.service:
name: ufw
enabled: true
state: started