ansible-role-postfix/tasks/postfix.yml

82 lines
2.1 KiB
YAML
Raw Normal View History

2023-03-20 20:01:04 +01:00
---
- name: "Postfix | Copy main.cf"
ansible.builtin.template:
src: postfix/main.cf.j2
dest: /etc/postfix/main.cf
mode: "0644"
notify: reload postfix
2023-04-19 12:56:49 +02:00
tags: maincf
2023-03-20 20:01:04 +01:00
- name: "Postfix | Copy master.cf"
ansible.builtin.template:
src: postfix/master.cf
dest: /etc/postfix/master.cf
mode: "0644"
notify: restart postfix
2023-04-19 12:56:49 +02:00
tags: mastercf
2023-03-20 20:01:04 +01:00
- name: "Postfix | Create configuration directory"
ansible.builtin.file:
path: "{{ postfix_conf_dir }}"
state: directory
mode: "0755"
- name: "Postfix | Copy lookup tables"
ansible.builtin.copy:
src: "postfix/conf.d/{{ item }}"
dest: "{{ postfix_conf_dir }}/{{ item }}"
mode: "0644"
loop:
- header_checks_inbound
- name: "Postfix | Copy lookup tables from templates"
ansible.builtin.template:
src: "postfix/conf.d/{{ item.name }}.j2"
dest: "{{ postfix_conf_dir }}/{{ item.name }}"
2023-06-14 18:16:14 +02:00
mode: "{{ item.mode | default('0644') }}"
2023-03-20 20:01:04 +01:00
loop:
- name: bad_smtp_auth_users
- name: bogus_mx
- name: canonical
- name: client_checks
- name: destination_limit
- name: header_add
2023-10-16 14:46:47 +02:00
- name: header_checks
- name: header_treatment
- name: helo_checks
- name: permit_sasl_login_mismatch
- name: postscreen_access
- name: relay_by_sender
- name: relay_checks
- name: sender_canonical
- name: sender_checks
- name: smtp_sasl_auth_password
mode: "0600"
- name: transport_global_exceptions
- name: transport_relay
2023-03-20 20:01:04 +01:00
notify: reload postfix
- name: "Postfix | Run postmap"
ansible.builtin.command: "postmap {{ item.table | default('cdb') }}:{{ item.file }}"
args:
chdir: "{{ postfix_conf_dir }}"
changed_when: false
notify: reload postfix
loop:
- file: bad_smtp_auth_users
2023-05-02 20:15:29 +02:00
- file: canonical
2023-03-20 20:01:04 +01:00
- file: client_checks
- file: destination_limit
- file: permit_sasl_login_mismatch
- file: relay_checks
2023-05-02 20:15:29 +02:00
- file: sender_canonical
2023-03-20 20:01:04 +01:00
- file: sender_checks
2023-06-14 17:00:42 +02:00
- file: smtp_sasl_auth_password
2023-03-20 20:01:04 +01:00
- file: transport_relay
- name: "Postfix | Create dhparam file"
community.crypto.openssl_dhparam:
path: "{{ postfix_dhparam_file }}"
size: 4096
when: postfix_type == "internet"