暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dovecot.yml 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. - name: Install Dovecot and related packages
  2. apt: pkg={{ item }} update_cache=yes state=installed
  3. with_items:
  4. - dovecot-core
  5. - dovecot-imapd
  6. - dovecot-lmtpd
  7. - dovecot-managesieved
  8. - dovecot-pgsql
  9. - dovecot-pop3d
  10. tags:
  11. - dependencies
  12. - name: Install Postgres for Dovecot
  13. apt: pkg=postgresql state=present
  14. tags:
  15. - dependencies
  16. - name: Create vmail group
  17. group: name=vmail state=present gid=5000
  18. - name: Create vmail user
  19. user: name=vmail group=vmail state=present uid=5000 home=/decrypted shell=/usr/sbin/nologin
  20. - name: Ensure mail domain directories are in place
  21. file: state=directory path=/decrypted/{{ item.name }} owner=vmail group=dovecot mode=0770
  22. with_items: '{{ mail_virtual_domains }}'
  23. - name: Ensure mail directories are in place
  24. file: state=directory path=/decrypted/{{ item.domain }}/{{ item.account }} owner=vmail group=dovecot
  25. with_items: '{{ mail_virtual_users }}'
  26. - name: Copy dovecot.conf into place
  27. copy: src=etc_dovecot_dovecot.conf dest=/etc/dovecot/dovecot.conf
  28. - name: Create before.d sieve scripts directory
  29. file: path=/etc/dovecot/sieve/before.d state=directory owner=vmail group=dovecot recurse=yes mode=0770
  30. notify: restart dovecot
  31. - name: Configure sieve script moving spam into Junk folder
  32. copy: src=etc_dovecot_sieve_before.d_no-spam.sieve dest=/etc/dovecot/sieve/before.d/no-spam.sieve owner=vmail group=dovecot
  33. notify: restart dovecot
  34. - name: Copy additional Dovecot configuration files in place
  35. copy: src=etc_dovecot_conf.d_{{ item }} dest=/etc/dovecot/conf.d/{{ item }}
  36. with_items:
  37. - 10-auth.conf
  38. - 10-mail.conf
  39. - 10-master.conf
  40. - 90-sieve.conf
  41. - 90-antispam.conf
  42. - auth-sql.conf.ext
  43. notify: restart dovecot
  44. - name: Template 10-ssl.conf
  45. template: src=etc_dovecot_conf.d_10-ssl.conf.j2 dest=/etc/dovecot/conf.d/10-ssl.conf
  46. notify: restart dovecot
  47. - name: Template 15-lda.conf
  48. template: src=etc_dovecot_conf.d_15-lda.conf.j2 dest=/etc/dovecot/conf.d/15-lda.conf
  49. notify: restart dovecot
  50. - name: Template dovecot-sql.conf.ext
  51. template: src=etc_dovecot_dovecot-sql.conf.ext.j2 dest=/etc/dovecot/dovecot-sql.conf.ext
  52. notify: restart dovecot
  53. - name: Ensure correct permissions on Dovecot config directory
  54. file: state=directory path=/etc/dovecot
  55. group=dovecot owner=vmail mode=0770 recurse=yes
  56. notify: restart dovecot
  57. - name: Set firewall rules for dovecot
  58. ufw: rule=allow port={{ item }} proto=tcp
  59. with_items:
  60. - imaps
  61. - pop3s
  62. tags: ufw
  63. - name: Update post-certificate-renewal task
  64. copy:
  65. content: "#!/bin/bash\n\nservice dovecot restart\n"
  66. dest: /etc/letsencrypt/postrenew/dovecot.sh
  67. mode: 0755
  68. owner: root
  69. group: root