--- - name: Instalar paquetes apt: state: present name: >- [ "dovecot-lmtpd", "ssl-cert", {% if dovecot_proto_imap_enable or dovecot_proto_imaps_enable -%} "dovecot-imapd", {% endif %} {% if dovecot_proto_pop3_enable or dovecot_proto_pop3s_enable -%} "dovecot-pop3d", {% endif %} {% if dovecot_ldap_enable -%} "dovecot-ldap", {% endif %} {% if dovecot_sieve_enable -%} "dovecot-sieve", {% endif %} {% if dovecot_proto_managesieve_enable -%} "dovecot-managesieved", {% endif %} {% if dovecot_antispam_enable -%} "dovecot-antispam", {% endif %} ] - name: Crear grupo para el mail group: name: "{{ dovecot_mail_group }}" gid: "{{ dovecot_mail_gid }}" - name: Crear usuario para el mail user: name: "{{ dovecot_mail_user }}" uid: "{{ dovecot_mail_uid }}" group: "{{ dovecot_mail_group }}" home: "{{ dovecot_mail_home }}" shell: /bin/false - name: Directorios de configuración de Dovecot file: path: "{{ item }}" state: directory loop: - /etc/dovecot/conf.d - "{{ dovecot_sieve_before }}" - "{{ dovecot_sieve_after }}" - name: Configuración de Dovecot (1) template: dest: "/etc/dovecot/conf.d/{{ item }}" src: "{{item}}.j2" loop: - 10-mail.conf - 10-auth.conf - 10-ssl.conf - 20-lmtp.conf - 20-imap.conf - 10-master.conf - auth-ldap.conf.ext - 15-mailboxes.conf - 90-sieve.conf - 90-quota.conf - 90-antispam.conf notify: restart dovecot - name: Configuración de Dovecot (2-LDAP) template: dest: "/etc/dovecot/dovecot-ldap.conf.ext" src: "dovecot-ldap.conf.ext.j2" notify: restart dovecot - name: Configuración de Dovecot (3-LDAP) file: src: dovecot-ldap.conf.ext dest: /etc/dovecot/dovecot-ldap2.conf.ext state: link notify: restart dovecot - name: Filtro de spam global template: src: junk-filter.sieve.j2 dest: "{{ dovecot_sieve_before }}/junk-filter.sieve" notify: recompile sieve scripts