2017-01-02 00:06:18 +01:00
|
|
|
- name: ensure packages are installed
|
|
|
|
apt:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- postfix
|
|
|
|
- mailgraph
|
2017-10-11 11:10:43 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: ensure ldap packages are installed
|
|
|
|
apt:
|
|
|
|
name: "postfix-ldap"
|
|
|
|
state: present
|
|
|
|
when: postfix_packmail == True
|
|
|
|
tags:
|
|
|
|
- postfix
|
2017-01-02 00:06:18 +01:00
|
|
|
|
|
|
|
- name: check if main.cf is default
|
2017-10-08 22:47:03 +02:00
|
|
|
shell: grep -v -E "^(myhostname|mydestination|mailbox_command)" /etc/postfix/main.cf | md5sum -
|
2017-01-02 00:06:18 +01:00
|
|
|
changed_when: False
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2017-01-02 00:06:18 +01:00
|
|
|
register: default_main_cf
|
2017-10-11 11:10:43 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
2017-01-12 17:22:16 +01:00
|
|
|
|
2017-10-11 11:10:43 +02:00
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: create minimal main.cf
|
|
|
|
template:
|
|
|
|
src: evolinux_main.cf.j2
|
|
|
|
dest: /etc/postfix/main.cf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
force: yes
|
|
|
|
when: postfix_packmail != True
|
|
|
|
notify: restart postfix
|
|
|
|
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
|
|
|
|
when: postfix_packmail == True
|
|
|
|
notify: restart postfix
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
when: postfix_force_main_cf == True or
|
|
|
|
default_main_cf.stdout == "5450c05d65878e99dad696c7c722e511 -" or
|
2017-08-23 03:13:04 +02:00
|
|
|
default_main_cf.stdout == "30022953f1f61f002bfb72e163ecb27e -"
|
2017-01-02 00:06:18 +01:00
|
|
|
|
2017-10-17 13:27:05 +02:00
|
|
|
- name: deploy packmail master.cf
|
2017-10-24 15:09:14 +02:00
|
|
|
template:
|
|
|
|
src: packmail_master.cf.j2
|
2017-10-17 13:27:05 +02:00
|
|
|
dest: /etc/postfix/master.cf
|
|
|
|
mode: "0644"
|
|
|
|
when: postfix_packmail == True
|
|
|
|
notify: restart postfix
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: copy default filter files
|
|
|
|
copy:
|
|
|
|
src: filter
|
|
|
|
dest: "/etc/postfix/{{ item }}"
|
|
|
|
force: no
|
|
|
|
with_items:
|
|
|
|
- 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
|
|
|
|
when: postfix_packmail == True
|
|
|
|
register: postfix_copy_filter
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: postmap filter files
|
|
|
|
command: "postmap /etc/postfix/{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- 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
|
|
|
|
when: postfix_packmail == True and postfix_copy_filter.changed
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2017-10-11 11:10:43 +02:00
|
|
|
- name: deploy ldap postfix config
|
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "/etc/postfix/{{ item }}"
|
|
|
|
mode: "0644"
|
|
|
|
with_items:
|
|
|
|
- virtual_aliases.cf
|
|
|
|
- virtual_domains.cf
|
|
|
|
- virtual_mailboxes.cf
|
|
|
|
when: postfix_packmail == True
|
|
|
|
notify: restart postfix
|
|
|
|
tags:
|
|
|
|
- postfix
|
2017-01-02 00:06:18 +01:00
|
|
|
|
2017-10-24 15:23:52 +02:00
|
|
|
- name: copy spam.sh script
|
|
|
|
copy:
|
|
|
|
src: spam.sh
|
|
|
|
dest: /usr/share/scripts/spam.sh
|
|
|
|
mode: "0700"
|
|
|
|
when: postfix_packmail == True
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: enable spam.sh cron
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/cron.d/spam
|
|
|
|
line: "42 * * * * /usr/share/scripts/spam.sh"
|
|
|
|
create: yes
|
|
|
|
state: present
|
|
|
|
mode: "0640"
|
|
|
|
when: postfix_packmail == True
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: update antispam list
|
|
|
|
command: /usr/share/scripts/spam.sh
|
|
|
|
changed_when: false
|
|
|
|
when: postfix_packmail == True
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2017-01-02 00:32:29 +01:00
|
|
|
- include: slow_transport.yml
|
2017-01-12 17:22:16 +01:00
|
|
|
when: postfix_slow_transport_include
|
2017-10-11 11:10:43 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|