2023-06-18 23:43:54 +02:00
|
|
|
---
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install the needed packages
|
2024-12-19 13:22:42 +10:00
|
|
|
ansible.builtin.package:
|
2023-06-18 23:43:54 +02:00
|
|
|
name:
|
|
|
|
|
- postfix
|
|
|
|
|
- cyrus-sasl
|
|
|
|
|
- cyrus-sasl-plain
|
|
|
|
|
tags:
|
|
|
|
|
- smtp_auth_relay
|
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Create the password file
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy:
|
2023-06-18 23:43:54 +02:00
|
|
|
dest: /etc/postfix/sasl_passwd
|
2023-06-19 10:36:47 +02:00
|
|
|
content: "{{ smtp_auth_relay_host }} {{ smtp_auth_relay_user }}:{{ smtp_auth_relay_password }}"
|
2024-11-27 13:48:08 +10:00
|
|
|
mode: "0600"
|
2023-06-18 23:43:54 +02:00
|
|
|
register: smtp_relay_password_file
|
|
|
|
|
tags:
|
|
|
|
|
- smtp_auth_relay
|
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Regenerate the password db file
|
2024-12-19 16:42:30 +10:00
|
|
|
ansible.builtin.shell: postmap /etc/postfix/sasl_passwd
|
2023-06-18 23:43:54 +02:00
|
|
|
when: smtp_relay_password_file.changed
|
2025-02-07 13:51:07 +01:00
|
|
|
notify: Restart postfix
|
2023-06-18 23:43:54 +02:00
|
|
|
tags:
|
|
|
|
|
- smtp_auth_relay
|