forked from evolix/ansible-roles
7ad296e74f
This reverts commit ec4fd5d27f
.
104 lines
2.2 KiB
YAML
104 lines
2.2 KiB
YAML
---
|
|
- name: ensure packages are installed
|
|
ansible.builtin.apt:
|
|
name:
|
|
- postfix
|
|
- postfix-ldap
|
|
- postfix-policyd-spf-python
|
|
- mailgraph
|
|
state: present
|
|
tags:
|
|
- postfix
|
|
|
|
- name: make /var/lib/mailgraph accessible by www-data
|
|
ansible.builtin.file:
|
|
path: "/var/lib/mailgraph"
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0755'
|
|
|
|
- name: make sure a service Mailgraph is running and enabled
|
|
ansible.builtin.systemd:
|
|
name: mailgraph.service
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: create packmail main.cf
|
|
ansible.builtin.template:
|
|
src: packmail_main.cf.j2
|
|
dest: /etc/postfix/main.cf
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
force: true
|
|
notify: restart postfix
|
|
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)
|
|
tags:
|
|
- postfix
|
|
|
|
- name: deploy packmail master.cf
|
|
ansible.builtin.template:
|
|
src: packmail_master.cf.j2
|
|
dest: /etc/postfix/master.cf
|
|
mode: "0644"
|
|
notify: restart postfix
|
|
tags:
|
|
- postfix
|
|
|
|
- name: copy default filter files
|
|
ansible.builtin.copy:
|
|
src: filter
|
|
dest: "/etc/postfix/{{ item }}"
|
|
force: false
|
|
loop:
|
|
- 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
|
|
ansible.builtin.command:
|
|
cmd: "postmap /etc/postfix/{{ item }}"
|
|
loop:
|
|
- 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_copy_filter is changed
|
|
tags:
|
|
- postfix
|
|
|
|
- name: deploy ldap postfix config
|
|
ansible.builtin.template:
|
|
src: "{{ item }}.j2"
|
|
dest: "/etc/postfix/{{ item }}"
|
|
mode: "0644"
|
|
loop:
|
|
- virtual_aliases.cf
|
|
- virtual_domains.cf
|
|
- virtual_mailboxes.cf
|
|
notify: restart postfix
|
|
tags:
|
|
- postfix
|
|
|
|
- ansible.builtin.include: packmail-spam.yml
|
|
|