ansible-role-postfix/tasks/postfix.yml
phil 8c79f8b687 Use Ansible defaults to insert comments
Enable vscodium code highlighting for some files
2024-03-27 17:39:16 +01:00

90 lines
2.3 KiB
YAML

---
- name: "Postfix | Copy main.cf"
ansible.builtin.template:
src: postfix/main.cf.j2
dest: /etc/postfix/main.cf
mode: "0644"
notify: reload postfix
tags: maincf
- name: "Postfix | Copy master.cf"
ansible.builtin.template:
src: postfix/master.cf.j2
dest: /etc/postfix/master.cf
mode: "0644"
notify: restart postfix
tags: mastercf
- 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 }}"
mode: "{{ item.mode | default('0644') }}"
loop:
- name: bad_smtp_auth_users
- name: bogus_mx
- name: canonical
- name: client_checks
- name: destination_limit
- name: header_add
- 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
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
- file: canonical
- file: client_checks
- file: destination_limit
- file: permit_sasl_login_mismatch
- file: relay_checks
- file: sender_canonical
- file: sender_checks
- file: smtp_sasl_auth_password
- file: transport_relay
- name: "Postfix | Create dhparam file"
community.crypto.openssl_dhparam:
path: "{{ postfix_dhparam_file }}"
size: 4096
when: postfix_type == "internet"
- name: "Postfix | Copy systemd override"
ansible.builtin.copy:
src: systemd/override.conf
dest: /etc/systemd/system/postfix@-.service.d/
mode: "0644"
notify:
- Reload systemd
- restart postfix