diff --git a/defaults/main.yml b/defaults/main.yml index e1c320e..39a30c8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,6 +5,18 @@ # carpeta por defecto para el mail dovecot_mail_home: "{{ vmail_home | default('/srv/mail') }}" +# usuario por defecto para el mail +dovecot_mail_user: "{{ vmail_user | default('vmail') }}" + +# uid por defecto para vmail +dovecot_mail_uid: "{{ vmail_uid | default(5000) }}" + +# grupo por defecto para vmail +dovecot_mail_group: "{{ vmail_group | default('vmail') }}" + +# gid por defecto para vmail +dovecot_mail_gid: "{{ vmail_gid | default(5000) }}" + # carpeta de mail de cada usuario dovecot_user_home: "{{ dovecot_mail_home }}/mail/%d/%n" diff --git a/tasks/main.yml b/tasks/main.yml index 414cf68..62f5401 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -24,6 +24,19 @@ {% 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 }}" diff --git a/templates/10-mail.conf.j2 b/templates/10-mail.conf.j2 index e4c7b9e..4322365 100644 --- a/templates/10-mail.conf.j2 +++ b/templates/10-mail.conf.j2 @@ -27,8 +27,8 @@ namespace inbox { # System user and group used to access mails. If you use multiple, userdb # can override these by returning uid or gid fields. You can use either numbers # or names. -mail_uid = {{ vmail_user }} -mail_gid = {{ vmail_group }} +mail_uid = {{ dovecot_mail_user }} +mail_gid = {{ dovecot_mail_group }} # Group to enable temporarily for privileged operations. Currently this is # used only with INBOX when either its initial creation or dotlocking fails. @@ -134,7 +134,7 @@ mail_gid = {{ vmail_group }} # Space separated list of plugins to load for all services. Plugins specific to # IMAP, LDA, etc. are added to this list in their own .conf files. -mail_plugins = $mail_plugins {% if dovecot_plugin_quota_enable -%} +mail_plugins = $mail_plugins {% if dovecot_quota_enable -%} quota {% endif %} @@ -144,7 +144,7 @@ quota # Mailbox list indexes can be used to optimize IMAP STATUS commands. They are # also required for IMAP NOTIFY extension to be enabled. -{% if dovecot_plugin_quota_enable and dovecot_plugin_quota.driver == "count" -%} +{% if dovecot_quota_enable and dovecot_quota_driver == "count" -%} mailbox_list_index = yes {% endif %}