31 lines
758 B
YAML
31 lines
758 B
YAML
|
---
|
||
|
- block:
|
||
|
- name: Create smtp_auth
|
||
|
template:
|
||
|
src: etc/postfix/sasl_passwd.j2
|
||
|
dest: /etc/postfix/smtp_auth
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 0600
|
||
|
register: __auth_result
|
||
|
|
||
|
- name: Ensure smtp_auth.db exist
|
||
|
stat:
|
||
|
path: /etc/postfix/smtp_auth.db
|
||
|
register: __authdb
|
||
|
|
||
|
- name: Create sasl_passwd.db
|
||
|
command: /usr/sbin/postmap hash:/etc/postfix/smtp_auth
|
||
|
when: not __authdb.stat.exists or __auth_result.changed
|
||
|
notify: __postfix_restart
|
||
|
|
||
|
- name: Set permissions for sasl_passwd.db
|
||
|
file:
|
||
|
path: /etc/postfix/sasl_passwd.db
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 0600
|
||
|
notify: __postfix_restart
|
||
|
become: True
|
||
|
become_user: root
|