ansible-roles/postfix/tasks/packmail.yml
William Hirigoyen 1f8738fbda
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2696|33|2663|34|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/467//ansiblelint">Evolix » ansible-roles » unstable #467</a>
gitea/ansible-roles/pipeline/head This commit looks good
postfix: move postfix installation from evolinux-base to postfix role, plus some refactoring
postfix:
* Move common packages installation in common.yml
* Replace ansible_fqdn by evolinux_fqdn, set postfix_slow_transport_include to false by default (only for packmails and packwebs)
* Remove dependency on evolinux_fqdn var
* Do not overwrite main.cf if it has been modified (except if postfix_force_main_cf)

evolinux-base:
* Move exim4 purge from evolinux-base to postfix role
* Call postfix role call after nagios role (dependency)
2024-02-01 18:00:48 +01:00

106 lines
2.2 KiB
YAML

---
- name: Complementary packmail packages are installed
ansible.builtin.apt:
name:
- postfix-ldap
- postfix-policyd-spf-python
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: display checksums of known main.cf files
debug:
var: main_cf_known_checksums
- 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 (main_cf_checksum.stdout in main_cf_known_checksums)
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