ansible role for debian buster setting up a mailserver with postfix, rspamd, dovecot and clamav and based on PostgreSQL; journal-postfix is a log parser for postfix; Attention: user and domain administration (in PostgreSQL) is not covered here
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.
 
 

82 lines
1.8 KiB

- name: install postfix packages
apt:
name: postfix,postfix-pgsql,postfix-doc
state: present
update_cache: yes
install_recommends: no
- name: divert /etc/postfix/main.cf
shell: dpkg-divert --add --rename --divert /etc/postfix/main.cf.orig /etc/postfix/main.cf
- name: divert /etc/postfix/master.cf
shell: dpkg-divert --add --rename --divert /etc/postfix/master.cf.orig /etc/postfix/master.cf
- name: group 'mailstore'
group:
name: mailstore
state: present
system: yes
gid: 5000
- name: user 'mailstore'
user:
name: mailstore
group: mailstore
state: present
shell: /usr/sbin/nologin
system: yes
uid: 5000
create_home: no
home: /srv/mailstore
password: '!'
password_lock: yes
comment: created by ansible
- name: directories /srv/mailstore /srv/mailstore/role_specific
file:
path: "{{ item }}"
state: directory
owner: mailstore
group: mailstore
mode: 0755
loop:
- /srv/mailstore
- /srv/mailstore/role_specific
- /srv/mailstore/role_specific/roles
- name: postfix configuration files
template:
src: "postfix/{{ item }}"
dest: "/etc/postfix/{{ item }}"
owner: root
group: root
mode: 0644
force: "{{ mailserver.postfix.overwrite_config }}"
loop:
- main.cf
- master.cf
- header_checks
- name: postfix database queries
template:
src: "postfix/{{ item }}"
dest: "/etc/postfix/{{ item }}"
owner: root
group: root
mode: 0600
force: yes
loop:
- domains.cf
- mailboxes.cf
- aliases.cf
- email_existence_check.cf
- relay_domains.cf
- relay_recipient_maps.cf
- transport_maps.cf
- sender_canonical_maps.cf
- recipient_canonical_maps.cf
- name: restart postfix
systemd:
name: postfix
state: restarted