- hosts: localhost tasks: - name: Allow port community.general.ufw: rule: allow port: "{{ port }}" proto: "{{ proto | default(omit) }}"