142 lines
3.4 KiB
YAML
142 lines
3.4 KiB
YAML
---
|
|
|
|
- name: Install packages
|
|
apt: name={{ item }} state=present
|
|
with_items:
|
|
- amavisd-new
|
|
- bsd-mailx
|
|
- dovecot-core
|
|
- dovecot-imapd
|
|
- dovecot-ldap
|
|
- dovecot-managesieved
|
|
- dovecot-sieve
|
|
- fcgiwrap
|
|
- mailman
|
|
- postfix
|
|
- postfix-ldap
|
|
- postfix-policyd-spf-python
|
|
- postgrey
|
|
- pyzor
|
|
- razor
|
|
- spamassassin
|
|
tags: mail
|
|
|
|
- name: Create vmail group
|
|
group: name=vmail gid=500 state=present
|
|
tags: mail
|
|
|
|
- name: Create vmail user
|
|
user: name=vmail group=vmail uid=500 createhome=yes home=/var/vmail shell=/bin/false state=present
|
|
tags: mail
|
|
|
|
- name: Configure amavis
|
|
template: src={{ item }}.j2 dest=/etc/{{ item }}
|
|
with_items:
|
|
- amavis/15-content_filter_mode
|
|
- amavis/50-user
|
|
notify: Restart amavis
|
|
tags: mail
|
|
|
|
- name: Create dovecot ssl directory
|
|
file: path=/etc/dovecot/ssl state=directory mode=0750 owner=dovecot group=dovecot
|
|
tags: mail
|
|
|
|
- name: Create dovecot log directory
|
|
file: path=/var/log/dovecot state=directory mode=0750 owner=vmail group=vmail
|
|
tags: mail
|
|
|
|
- name: Configure dovecot
|
|
template: src={{ item }}.j2 dest=/etc/{{ item }}
|
|
with_items:
|
|
- dovecot/dovecot-ldap.conf.ext
|
|
- dovecot/local.conf
|
|
notify: Restart dovecot
|
|
tags: mail
|
|
|
|
- name: Configure mailman
|
|
template: src={{ item }}.j2 dest=/etc/{{ item }}
|
|
with_items:
|
|
- mailman/mm_cfg.py
|
|
notify: Restart postfix
|
|
tags: mail
|
|
|
|
- name: Configure mailman vhost
|
|
template: src=nginx/vhost.j2 dest=/etc/nginx/sites-available/mailman
|
|
notify: Restart nginx
|
|
tags: mail
|
|
|
|
- name: Enable mailman vhost
|
|
file: src=/etc/nginx/sites-available/mailman dest=/etc/nginx/sites-enabled/mailman state=link
|
|
notify: Restart nginx
|
|
tags: mail
|
|
|
|
- name: Configure policyd
|
|
copy: src={{ item }} dest=/etc/postfix-policyd-spf-python/{{ item }}
|
|
with_items:
|
|
- policyd-spf.conf
|
|
tags: mail
|
|
|
|
- name: Create postfix ssl directory
|
|
file: path=/etc/postfix/ssl state=directory mode=0750 owner=postfix group=postfix
|
|
tags: mail
|
|
|
|
- name: Configure postfix
|
|
template: src={{ item }}.j2 dest=/etc/{{ item }}
|
|
with_items:
|
|
- postfix/main.cf
|
|
- postfix/master.cf
|
|
notify: Restart postfix
|
|
tags: mail
|
|
|
|
- name: Configure postfix maps
|
|
template: src={{ item }}.j2 dest=/etc/{{ item }}
|
|
with_items:
|
|
- postfix/helo_access
|
|
- postfix/ldap-aliases.cf
|
|
- postfix/ldap-virtual-maps.cf
|
|
- postfix/recipient_access
|
|
- postfix/transport
|
|
- postfix/virtual-alias
|
|
notify: Run postmap
|
|
tags: mail
|
|
|
|
- name: Configure certificate manager
|
|
template: src=certs.j2 dest=/etc/acme/domains.d/{{ ansible_fqdn }}_mail.conf
|
|
tags: mail
|
|
|
|
- name: Configure certificate manager for mailman
|
|
template: src=mailman/certs.j2 dest=/etc/acme/domains.d/{{ mailman_domain }}_mailman.conf
|
|
tags: mail
|
|
|
|
- name: Create razor directory structure
|
|
command: razor-admin -create chdir=/var/lib/amavis creates=/var/lib/amavis/.razor
|
|
become: yes
|
|
become_user: amavis
|
|
tags: mail
|
|
|
|
- name: Register razor
|
|
command: razor-admin -register chdir=/var/lib/amavis creates=/var/lib/amavis/.razor/identity
|
|
become: yes
|
|
become_user: amavis
|
|
tags: mail
|
|
|
|
- name: Start amavis
|
|
service: name=amavis state=started enabled=yes
|
|
tags: mail
|
|
|
|
- name: Start dovecot
|
|
service: name=dovecot state=started enabled=yes
|
|
tags: mail
|
|
|
|
- name: Start fcgiwrap
|
|
service: name=fcgiwrap state=started enabled=yes
|
|
tags: mail
|
|
|
|
- name: Start postfix
|
|
service: name=postfix state=started enabled=yes
|
|
tags: mail
|
|
|
|
- name: Start postgrey
|
|
service: name=postgrey state=started enabled=yes
|
|
tags: mail
|