---
- name: Manage the firewalld rules
  block:
    - name: Manage the dovecot related services
      firewalld: service={{ item.service }} zone={{ item.zone }} permanent={{ item.permanent | default(True) }} state={{ item.state }} immediate=True
      with_items: '{{ dovecot_firewalld_services }}'

    - name: Manage the dovecot related tcp/udp ports
      firewalld: port={{ item.port }}/{{ item.protocol }} zone={{ item.zone }} permanent={{ item.permanent | default(True) }} state={{ item.state }} immediate=True
      with_items: '{{ dovecot_firewalld_ports }}'

  tags: [ 'dovecot', 'firewall', 'firewalld', 'iptables', 'iptables_rules' ]