Няма описание
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.

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