1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- - name: Add wheezy-backports to get a reasonably current Dovecot on Debian 7
- apt_repository: repo='deb http://http.debian.net/debian wheezy-backports main'
- when: ansible_distribution_release == 'wheezy'
- tags:
- - dependencies
-
- - name: Install Dovecot and related packages on Debian 7
- apt: pkg={{ item }} update_cache=yes state=latest default_release=wheezy-backports
- with_items:
- - dovecot-core
- - dovecot-imapd
- - dovecot-lmtpd
- - dovecot-managesieved
- - dovecot-pgsql
- - dovecot-pop3d
- when: ansible_distribution_release == 'wheezy'
- tags:
- - dependencies
-
- - name: Install Dovecot and related packages on distributions other than Debian 7
- apt: pkg={{ item }} update_cache=yes state=installed
- with_items:
- - dovecot-core
- - dovecot-imapd
- - dovecot-lmtpd
- - dovecot-managesieved
- - dovecot-pgsql
- - dovecot-pop3d
- when: ansible_distribution_release != 'wheezy'
- tags:
- - dependencies
-
- - name: Install Postgres 9.1 for Dovecot on older distributions
- apt: pkg=postgresql-9.1 state=present
- when: ansible_distribution_release != 'trusty' and ansible_distribution_release != 'jessie'
- tags:
- - dependencies
-
- - name: Install Postgres 9.3 for Dovecot on Ubuntu Trusty
- apt: pkg=postgresql-9.3 state=present
- when: ansible_distribution_release == 'trusty'
- tags:
- - dependencies
-
- - name: Install Postgres 9.4 for Dovecot on Debian Jessie
- apt: pkg=postgresql-9.4 state=present
- when: ansible_distribution_release == 'jessie'
- tags:
- - dependencies
-
- - name: Create vmail group
- group: name=vmail state=present gid=5000
-
- - name: Create vmail user
- user: name=vmail group=vmail state=present uid=5000 home=/decrypted shell=/usr/sbin/nologin
-
- - name: Ensure mail domain directories are in place
- file: state=directory path=/decrypted/{{ item.name }} owner=vmail group=dovecot mode=770
- with_items: mail_virtual_domains
-
- - name: Ensure mail directories are in place
- file: state=directory path=/decrypted/{{ item.domain }}/{{ item.account }} owner=vmail group=dovecot
- with_items: mail_virtual_users
-
- - name: Copy dovecot.conf into place
- copy: src=etc_dovecot_dovecot.conf dest=/etc/dovecot/dovecot.conf
-
- - name: Copy additional Dovecot configuration files in place
- copy: src=etc_dovecot_conf.d_{{ item }} dest=/etc/dovecot/conf.d/{{ item }}
- with_items:
- - 10-auth.conf
- - 10-mail.conf
- - 10-master.conf
- - 10-ssl.conf
- - auth-sql.conf.ext
- notify: restart dovecot
-
- - name: Template 15-lda.conf
- template: src=etc_dovecot_conf.d_15-lda.conf.j2 dest=/etc/dovecot/conf.d/15-lda.conf
- notify: restart dovecot
-
- - name: Template dovecot-sql.conf.ext
- template: src=etc_dovecot_dovecot-sql.conf.ext.j2 dest=/etc/dovecot/dovecot-sql.conf.ext
- notify: restart dovecot
-
- - name: Ensure correct permissions on Dovecot config directory
- file: state=directory path=/etc/dovecot
- group=dovecot owner=vmail mode=770 recurse=yes
- notify: restart dovecot
-
- - name: Set firewall rules for dovecot
- ufw: rule=allow port={{ item }} proto=tcp
- with_items:
- - imaps
- - pop3s
|