Skip to content

Commit

Permalink
Merge pull request #11 from Oefenweb/sasl-password-maps
Browse files Browse the repository at this point in the history
Sasl password maps
  • Loading branch information
tersmitten committed May 21, 2015
2 parents 7029047 + c33b573 commit 4ab14a7
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ None
* `postfix_relayport` [default: 587]: Relay port (on postfix_relayhost, if set)
* `postfix_relaytls` [default: `false`]: Use TLS when sending with a relay host
* `postfix_sasl_user` [default: `postmaster@{{ ansible_domain }}`]: SASL relay username
* `postfix_sasl_password` [default: `k8+haga4@#pR`]: SASL relay password
* `postfix_sasl_password` [default: `k8+haga4@#pR`]: SASL relay password **Make sure to change!**

## Dependencies

Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# defaults file for postfix
---
postfix_install:
- postfix
- mailutils
Expand Down
6 changes: 5 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
# handlers file for postfix
---
- name: restart postfix
service:
name: postfix
state: restarted

- name: new aliases
command: newaliases

- name: postmap sasl_passwd
command: postmap hash:/etc/postfix/sasl_passwd
9 changes: 6 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# meta file for postfix
---
galaxy_info:
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
Expand All @@ -9,10 +9,13 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- all
- lucid
- precise
- trusty
- name: Debian
versions:
- all
- squeeze
- wheezy
categories:
- system
- web
Expand Down
15 changes: 14 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# tasks file for postfix
---
- name: configure debconf
debconf:
name: "{{ item.name }}"
Expand Down Expand Up @@ -37,6 +37,19 @@
notify: restart postfix
tags: [configuration, postfix, postfix-configuration]

- name: configure sasl username/password
template:
src: etc/postfix/sasl_passwd.j2
dest: /etc/postfix/sasl_passwd
owner: root
group: root
mode: 0600
when: postfix_relayhost != false
notify:
- postmap sasl_passwd
- restart postfix
tags: [configuration, postfix, postfix-sasl-passwd]

- name: configure aliases
lineinfile:
dest: /etc/aliases
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/postfix/main.cf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ inet_protocols = ipv4
{% if postfix_relayhost %}
relayhost = [{{ postfix_relayhost }}]:{{ postfix_relayhost_port }}
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:{{ postfix_sasl_user }}:{{ postfix_sasl_password }}
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
{% if postfix_relaytls %}
smtp_use_tls = yes
Expand Down
3 changes: 3 additions & 0 deletions templates/etc/postfix/sasl_passwd.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# {{ ansible_managed }}

[{{ postfix_relayhost }}]:{{ postfix_relayhost_port }} {{ postfix_sasl_user }}:{{ postfix_sasl_password }}
2 changes: 1 addition & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# test file for postfix
---
- hosts: localhost
remote_user: root
roles:
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# test file for postfix
---
- hosts: all
remote_user: vagrant
sudo: true
Expand Down
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# vars file for postfix
---
postfix_debconf_selections:
- name: postfix
question: postfix/main_mailer_type
Expand Down

0 comments on commit 4ab14a7

Please sign in to comment.