2019-08-24 13:01:30 +00:00
|
|
|
---
|
|
|
|
- block:
|
2019-08-24 14:12:21 +00:00
|
|
|
- name: Set postfix settings to registry
|
|
|
|
ucr:
|
|
|
|
path: "{{ item.path }}"
|
|
|
|
value: "{{ item.value }}"
|
|
|
|
state: "{{ item.state | default('present') }}"
|
|
|
|
loop: "{{ __postfix_registry_settings }}"
|
|
|
|
|
2019-08-24 13:01:30 +00:00
|
|
|
- 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
|
|
|
|
|
2019-08-24 14:04:37 +00:00
|
|
|
- name: Create smtp_auth.db
|
2019-08-24 13:01:30 +00:00
|
|
|
command: /usr/sbin/postmap hash:/etc/postfix/smtp_auth
|
|
|
|
when: not __authdb.stat.exists or __auth_result.changed
|
|
|
|
notify: __postfix_restart
|
|
|
|
|
2019-08-24 14:04:37 +00:00
|
|
|
- name: Set permissions for smtp_auth.db
|
2019-08-24 13:01:30 +00:00
|
|
|
file:
|
2019-08-24 14:04:37 +00:00
|
|
|
path: /etc/postfix/smtp_auth.db
|
2019-08-24 13:01:30 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0600
|
|
|
|
notify: __postfix_restart
|
|
|
|
become: True
|
|
|
|
become_user: root
|