Skip to content

Commit 4ab14a7

Browse files
committed
Merge pull request #11 from Oefenweb/sasl-password-maps
Sasl password maps
2 parents 7029047 + c33b573 commit 4ab14a7

File tree

10 files changed

+34
-11
lines changed

10 files changed

+34
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ None
1818
* `postfix_relayport` [default: 587]: Relay port (on postfix_relayhost, if set)
1919
* `postfix_relaytls` [default: `false`]: Use TLS when sending with a relay host
2020
* `postfix_sasl_user` [default: `postmaster@{{ ansible_domain }}`]: SASL relay username
21-
* `postfix_sasl_password` [default: `k8+haga4@#pR`]: SASL relay password
21+
* `postfix_sasl_password` [default: `k8+haga4@#pR`]: SASL relay password **Make sure to change!**
2222

2323
## Dependencies
2424

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
# defaults file for postfix
2+
---
33
postfix_install:
44
- postfix
55
- mailutils

handlers/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
---
21
# handlers file for postfix
2+
---
33
- name: restart postfix
44
service:
55
name: postfix
66
state: restarted
7+
78
- name: new aliases
89
command: newaliases
10+
11+
- name: postmap sasl_passwd
12+
command: postmap hash:/etc/postfix/sasl_passwd

meta/main.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
# meta file for postfix
2+
---
33
galaxy_info:
44
author: Mischa ter Smitten
55
company: Oefenweb.nl B.V.
@@ -9,10 +9,13 @@ galaxy_info:
99
platforms:
1010
- name: Ubuntu
1111
versions:
12-
- all
12+
- lucid
13+
- precise
14+
- trusty
1315
- name: Debian
1416
versions:
15-
- all
17+
- squeeze
18+
- wheezy
1619
categories:
1720
- system
1821
- web

tasks/main.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
# tasks file for postfix
2+
---
33
- name: configure debconf
44
debconf:
55
name: "{{ item.name }}"
@@ -37,6 +37,19 @@
3737
notify: restart postfix
3838
tags: [configuration, postfix, postfix-configuration]
3939

40+
- name: configure sasl username/password
41+
template:
42+
src: etc/postfix/sasl_passwd.j2
43+
dest: /etc/postfix/sasl_passwd
44+
owner: root
45+
group: root
46+
mode: 0600
47+
when: postfix_relayhost != false
48+
notify:
49+
- postmap sasl_passwd
50+
- restart postfix
51+
tags: [configuration, postfix, postfix-sasl-passwd]
52+
4053
- name: configure aliases
4154
lineinfile:
4255
dest: /etc/aliases

templates/etc/postfix/main.cf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ inet_protocols = ipv4
4141
{% if postfix_relayhost %}
4242
relayhost = [{{ postfix_relayhost }}]:{{ postfix_relayhost_port }}
4343
smtp_sasl_auth_enable = yes
44-
smtp_sasl_password_maps = static:{{ postfix_sasl_user }}:{{ postfix_sasl_password }}
44+
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
4545
smtp_sasl_security_options = noanonymous
4646
{% if postfix_relaytls %}
4747
smtp_use_tls = yes

templates/etc/postfix/sasl_passwd.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# {{ ansible_managed }}
2+
3+
[{{ postfix_relayhost }}]:{{ postfix_relayhost_port }} {{ postfix_sasl_user }}:{{ postfix_sasl_password }}

tests/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
# test file for postfix
2+
---
33
- hosts: localhost
44
remote_user: root
55
roles:

tests/vagrant.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
# test file for postfix
2+
---
33
- hosts: all
44
remote_user: vagrant
55
sudo: true

vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
# vars file for postfix
2+
---
33
postfix_debconf_selections:
44
- name: postfix
55
question: postfix/main_mailer_type

0 commit comments

Comments
 (0)