1
0
Fork 0
forked from infra/ansible
infra-ansible/roles/smtp-auth-relay/tasks/main.yml

25 lines
640 B
YAML
Raw Normal View History

---
- name: Install the needed packages
ansible.builtin.package:
name:
- postfix
- cyrus-sasl
- cyrus-sasl-plain
tags:
- smtp_auth_relay
- name: Create the password file
ansible.builtin.copy:
dest: /etc/postfix/sasl_passwd
content: "{{ smtp_auth_relay_host }} {{ smtp_auth_relay_user }}:{{ smtp_auth_relay_password }}"
mode: "0600"
register: smtp_relay_password_file
tags:
- smtp_auth_relay
- name: Regenerate the password db file
ansible.builtin.shell: postmap /etc/postfix/sasl_passwd
when: smtp_relay_password_file.changed
notify: Restart postfix
tags:
- smtp_auth_relay