2017-10-27 11:52:03 +02:00
|
|
|
---
|
|
|
|
- name: ensure packages are installed
|
|
|
|
apt:
|
2019-12-31 15:25:10 +01:00
|
|
|
name:
|
|
|
|
- postfix
|
|
|
|
- postfix-ldap
|
|
|
|
- postfix-policyd-spf-python
|
|
|
|
- mailgraph
|
2017-10-27 11:52:03 +02:00
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: create packmail main.cf
|
|
|
|
template:
|
|
|
|
src: packmail_main.cf.j2
|
|
|
|
dest: /etc/postfix/main.cf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
force: yes
|
|
|
|
notify: restart postfix
|
2021-05-09 23:06:42 +02:00
|
|
|
when: (postfix_force_main_cf | bool) or (postfix_maincf_md5_jessie in default_main_cf.stdout) or (postfix_maincf_md5_stretch in default_main_cf.stdout)
|
2017-10-27 11:52:03 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: deploy packmail master.cf
|
|
|
|
template:
|
|
|
|
src: packmail_master.cf.j2
|
|
|
|
dest: /etc/postfix/master.cf
|
|
|
|
mode: "0644"
|
|
|
|
notify: restart postfix
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: copy default filter files
|
|
|
|
copy:
|
|
|
|
src: filter
|
|
|
|
dest: "/etc/postfix/{{ item }}"
|
|
|
|
force: no
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2017-10-27 11:52:03 +02:00
|
|
|
- virtual
|
|
|
|
- client.access
|
|
|
|
- client.access_local
|
|
|
|
- header_kill
|
|
|
|
- header_kill_local
|
|
|
|
- recipient.access
|
|
|
|
- recipient.access_local
|
|
|
|
- sa-blacklist.access
|
|
|
|
- sender.access
|
|
|
|
- sender.access_local
|
|
|
|
- spamd.cidr
|
|
|
|
register: postfix_copy_filter
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: postmap filter files
|
|
|
|
command: "postmap /etc/postfix/{{ item }}"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2017-10-27 11:52:03 +02:00
|
|
|
- virtual
|
|
|
|
- client.access
|
|
|
|
- client.access_local
|
|
|
|
- header_kill
|
|
|
|
- header_kill_local
|
|
|
|
- recipient.access
|
|
|
|
- recipient.access_local
|
|
|
|
- sa-blacklist.access
|
|
|
|
- sender.access
|
|
|
|
- sender.access_local
|
|
|
|
- spamd.cidr
|
2021-05-09 23:06:42 +02:00
|
|
|
when: postfix_copy_filter is changed
|
2017-10-27 11:52:03 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: deploy ldap postfix config
|
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "/etc/postfix/{{ item }}"
|
|
|
|
mode: "0644"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2017-10-27 11:52:03 +02:00
|
|
|
- virtual_aliases.cf
|
|
|
|
- virtual_domains.cf
|
|
|
|
- virtual_mailboxes.cf
|
|
|
|
notify: restart postfix
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2017-11-07 12:18:02 +01:00
|
|
|
- include_role:
|
2019-11-29 14:00:25 +01:00
|
|
|
name: evolix/remount-usr
|
2017-10-31 15:17:18 +01:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2017-10-27 11:52:03 +02:00
|
|
|
- name: copy spam.sh script
|
|
|
|
copy:
|
|
|
|
src: spam.sh
|
|
|
|
dest: /usr/share/scripts/spam.sh
|
|
|
|
mode: "0700"
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2019-10-21 15:25:00 +02:00
|
|
|
- name: Check if cron is installed
|
|
|
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
|
|
|
failed_when: False
|
|
|
|
changed_when: False
|
|
|
|
register: is_cron_installed
|
|
|
|
|
2017-10-27 11:52:03 +02:00
|
|
|
- name: enable spam.sh cron
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/cron.d/spam
|
2017-12-01 12:06:13 +01:00
|
|
|
line: "42 * * * * root /usr/share/scripts/spam.sh"
|
2017-10-27 11:52:03 +02:00
|
|
|
create: yes
|
|
|
|
state: present
|
|
|
|
mode: "0640"
|
2019-10-21 15:25:00 +02:00
|
|
|
when: is_cron_installed.rc == 0
|
2017-10-27 11:52:03 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: update antispam list
|
|
|
|
command: /usr/share/scripts/spam.sh
|
|
|
|
changed_when: false
|
|
|
|
tags:
|
|
|
|
- postfix
|