small fixes to fit best practices
This commit is contained in:
parent
a6a4eb0867
commit
7e19f2faca
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
sasl_host: ""
|
postfix_relay_sasl_host: smtp.gmail.com
|
||||||
sasl_user: ""
|
postfix_relay_sasl_user: user
|
||||||
sasl_domain: ""
|
postfix_relay_sasl_domain: gmail.com
|
||||||
sasl_passwd: "{{ vault_sasl_passwd }}"
|
postfix_relay_sasl_passwd: secure
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Configure postfix
|
- name: Configure postfix
|
||||||
template:
|
template:
|
||||||
src: 'etc/postfix/main.cf.j2'
|
src: etc/postfix/main.cf.j2
|
||||||
dest: '/etc/postfix/main.cf'
|
dest: /etc/postfix/main.cf
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
- name: Create sasl
|
- name: Create sasl
|
||||||
template:
|
template:
|
||||||
src: 'etc/postfix/sasl_passwd.j2'
|
src: etc/postfix/sasl_passwd.j2
|
||||||
dest: '/etc/postfix/sasl_passwd'
|
dest: /etc/postfix/sasl_passwd
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0600
|
mode: 0600
|
||||||
@ -19,18 +19,18 @@
|
|||||||
|
|
||||||
- name: Ensure sasl_passwd.db exist
|
- name: Ensure sasl_passwd.db exist
|
||||||
stat:
|
stat:
|
||||||
path: '/etc/postfix/sasl_passwd.db'
|
path: /etc/postfix/sasl_passwd.db
|
||||||
register: sasldb
|
register: sasldb
|
||||||
|
|
||||||
- name: Create sasl_passwd.db
|
- name: Create sasl_passwd.db
|
||||||
command: '/usr/sbin/postmap hash:/etc/postfix/sasl_passwd'
|
command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
|
||||||
when: sasldb.stat.exists == 'false' or sasl_result.changed
|
when: not sasldb.stat.exists or sasl_result.changed
|
||||||
register: sasldb_update
|
register: sasldb_update
|
||||||
notify: postfix_restart
|
notify: postfix_restart
|
||||||
|
|
||||||
- name: Set permissions for sasl_passwd.db
|
- name: Set permissions for sasl_passwd.db
|
||||||
file:
|
file:
|
||||||
path: '/etc/postfix/sasl_passwd.db'
|
path: /etc/postfix/sasl_passwd.db
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0600
|
mode: 0600
|
||||||
@ -38,8 +38,8 @@
|
|||||||
|
|
||||||
- name: Override outgoing header
|
- name: Override outgoing header
|
||||||
template:
|
template:
|
||||||
src: 'etc/postfix/sender_canonical.j2'
|
src: etc/postfix/sender_canonical.j2
|
||||||
dest: '/etc/postfix/sender_canonical'
|
dest: /etc/postfix/sender_canonical
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0600
|
mode: 0600
|
||||||
@ -47,11 +47,11 @@
|
|||||||
|
|
||||||
- name: Ensure sender_canonical.db exist
|
- name: Ensure sender_canonical.db exist
|
||||||
stat:
|
stat:
|
||||||
path: '/etc/postfix/sender_canonical.db'
|
path: /etc/postfix/sender_canonical.db
|
||||||
register: senderdb
|
register: senderdb
|
||||||
|
|
||||||
- name: Hash sender_canoncial
|
- name: Hash sender_canoncial
|
||||||
command: '/usr/sbin/postmap hash:/etc/postfix/sender_canonical'
|
command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
|
||||||
when: senderdb.stat.exists == false or sender_result.changed
|
when: not senderdb.stat.exists or sender_result.changed
|
||||||
register: senderdb_update
|
register: senderdb_update
|
||||||
notify: postfix_restart
|
notify: postfix_restart
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
{{ sasl_host }} {{ sasl_user }}@{{ sasl_domain }}:{{ sasl_passwd }}
|
{{ postfix_relay_sasl_host }} {{ postfix_relay_sasl_user }}@{{ postfix_relay_sasl_domain }}:{{ postfix_relay_sasl_passwd }}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
root {{ ansible_hostname }}@{{ sasl_domain }}
|
root {{ ansible_hostname }}@{{ postfix_relay_sasl_domain }}
|
||||||
|
Loading…
Reference in New Issue
Block a user