small fixes to fit best practices

This commit is contained in:
Robert Kaussow 2018-06-24 14:27:19 +02:00
parent a6a4eb0867
commit 7e19f2faca
4 changed files with 19 additions and 19 deletions

View File

@ -1,5 +1,5 @@
---
sasl_host: ""
sasl_user: ""
sasl_domain: ""
sasl_passwd: "{{ vault_sasl_passwd }}"
postfix_relay_sasl_host: smtp.gmail.com
postfix_relay_sasl_user: user
postfix_relay_sasl_domain: gmail.com
postfix_relay_sasl_passwd: secure

View File

@ -1,8 +1,8 @@
---
- name: Configure postfix
template:
src: 'etc/postfix/main.cf.j2'
dest: '/etc/postfix/main.cf'
src: etc/postfix/main.cf.j2
dest: /etc/postfix/main.cf
owner: root
group: root
mode: 0644
@ -10,8 +10,8 @@
- name: Create sasl
template:
src: 'etc/postfix/sasl_passwd.j2'
dest: '/etc/postfix/sasl_passwd'
src: etc/postfix/sasl_passwd.j2
dest: /etc/postfix/sasl_passwd
owner: root
group: root
mode: 0600
@ -19,18 +19,18 @@
- name: Ensure sasl_passwd.db exist
stat:
path: '/etc/postfix/sasl_passwd.db'
path: /etc/postfix/sasl_passwd.db
register: sasldb
- name: Create sasl_passwd.db
command: '/usr/sbin/postmap hash:/etc/postfix/sasl_passwd'
when: sasldb.stat.exists == 'false' or sasl_result.changed
command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
when: not sasldb.stat.exists or sasl_result.changed
register: sasldb_update
notify: postfix_restart
- name: Set permissions for sasl_passwd.db
file:
path: '/etc/postfix/sasl_passwd.db'
path: /etc/postfix/sasl_passwd.db
owner: root
group: root
mode: 0600
@ -38,8 +38,8 @@
- name: Override outgoing header
template:
src: 'etc/postfix/sender_canonical.j2'
dest: '/etc/postfix/sender_canonical'
src: etc/postfix/sender_canonical.j2
dest: /etc/postfix/sender_canonical
owner: root
group: root
mode: 0600
@ -47,11 +47,11 @@
- name: Ensure sender_canonical.db exist
stat:
path: '/etc/postfix/sender_canonical.db'
path: /etc/postfix/sender_canonical.db
register: senderdb
- name: Hash sender_canoncial
command: '/usr/sbin/postmap hash:/etc/postfix/sender_canonical'
when: senderdb.stat.exists == false or sender_result.changed
command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
when: not senderdb.stat.exists or sender_result.changed
register: senderdb_update
notify: postfix_restart

View File

@ -1,3 +1,3 @@
# {{ 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 }}

View File

@ -1,3 +1,3 @@
# {{ ansible_managed }}
root {{ ansible_hostname }}@{{ sasl_domain }}
root {{ ansible_hostname }}@{{ postfix_relay_sasl_domain }}