- name: Install dovecot ansible.builtin.apt: pkg: - dovecot-common - dovecot-imapd - dovecot-submissiond - name: Copy dovecot config ansible.builtin.template: src: dovecot.conf.j2 dest: /etc/dovecot/dovecot.conf owner: root group: root mode: 0644 notify: Reload dovecot - name: Copy dovecot proxy configs ansible.builtin.template: src: proxy-sql.conf.j2 dest: "/etc/dovecot/proxy-domain-{{ item.key }}-sql.conf" owner: root group: root mode: 0644 loop: "{{ dovecot_proxy.domain_proxies|dict2items }}" notify: Reload dovecot