-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Oefenweb/make-relayhost-configurable
Make relayhost configurable
- Loading branch information
Showing
6 changed files
with
111 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,10 @@ None | |
* `postfix_mailname` [default: `{{ ansible_fqdn }}`]: Mail name (in `/etc/mailname`), used for `myorigin` | ||
* `postfix_aliases` [default: `[]`]: Aliases to ensure present in `/etc/aliases` | ||
* `postfix_virtual_aliases` [default: `[]`]: Virtual aliases to ensure present in `/etc/postfix/virtual` | ||
* `postfix_sender_canonical_maps` [default: `[]`]: Sender address rewriting in `/etc/postfix/sender_canonical_maps` ([see](http://www.postfix.org/postconf.5.html#sender_canonical_maps)) | ||
* `postfix_recipient_canonical_maps` [default: `[]`]: Recipient address rewriting in `/etc/postfix/recipient_canonical_maps` ([see](http://www.postfix.org/postconf.5.html#recipient_canonical_maps)) | ||
* `postfix_sender_canonical_maps` [default: `[]`]: Sender address rewriting in `/etc/postfix/sender_canonical_maps` ([see](http://www.postfix.org/postconf.5.html#transport_maps)) | ||
* `postfix_recipient_canonical_maps` [default: `[]`]: Recipient address rewriting in `/etc/postfix/recipient_canonical_maps` ([see](http://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps)) | ||
* `postfix_transport_maps` [default: `[]`]: Transport mapping based on recipient address `/etc/postfix/transport_maps` ([see](http://www.postfix.org/postconf.5.html#recipient_canonical_maps)) | ||
* `postfix_sender_dependent_relayhost_maps` [default: `[]`]: Transport mapping based on sender address `/etc/postfix/sender_dependent_relayhost_maps` ([see](http://www.postfix.org/postconf.5.html#recipient_canonical_maps)) | ||
* `postfix_header_checks` [default: `[]`]: Lookup tables for content inspection of primary non-MIME message headers `/etc/postfix/header_checks` ([see](http://www.postfix.org/postconf.5.html#header_checks)) | ||
* `postfix_generic:` [default: `[]`]: Generic table address mapping in `/etc/postfix/generic` ([see](http://www.postfix.org/generic.5.html)) | ||
* `postfix_mydestination` [default: `["{{ postfix_hostname }}", 'localdomain', 'localhost', 'localhost.localdomain']`]: Specifies what domains this machine will deliver locally, instead of forwarding to another machine | ||
|
@@ -48,9 +50,10 @@ None | |
* `debconf` | ||
* `debconf-utils` | ||
|
||
#### Example | ||
#### Example(s) | ||
|
||
A simple example that doesn't use SASL relaying: | ||
|
||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -63,6 +66,7 @@ A simple example that doesn't use SASL relaying: | |
``` | ||
A simple example with virtual aliases for mail forwarding that doesn't use SASL relaying: | ||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -83,6 +87,7 @@ A simple example with virtual aliases for mail forwarding that doesn't use SASL | |
``` | ||
A simple example that rewrites the sender address: | ||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -91,10 +96,11 @@ A simple example that rewrites the sender address: | |
vars: | ||
postfix_sender_canonical_maps: | ||
- sender: root | ||
rewrite: postmaster@example.com | ||
rewrite: postmaster@yourdomain.org | ||
``` | ||
Provide the relay host name if you want to enable relaying: | ||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -107,7 +113,30 @@ Provide the relay host name if you want to enable relaying: | |
postfix_relayhost: mail.yourdomain.org | ||
``` | ||
Conditional relaying: | ||
```yaml | ||
--- | ||
- hosts: all | ||
roles: | ||
- postfix | ||
vars: | ||
postfix_transport_maps: | ||
- pattern: '[email protected]' | ||
result: ':' | ||
- pattern: '*' | ||
result: "smtp:{{ ansible_lo['ipv4']['address'] }}:1025" | ||
postfix_sender_dependent_relayhost_maps: | ||
- pattern: '[email protected]' | ||
result: 'DUNNO' | ||
- pattern: '[email protected]' | ||
result: 'DUNNO' | ||
- pattern: '*' | ||
result: "smtp:{{ ansible_lo['ipv4']['address'] }}:1025" | ||
``` | ||
For AWS SES support: | ||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -125,6 +154,7 @@ For AWS SES support: | |
``` | ||
For MailHog support: | ||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -140,6 +170,7 @@ For MailHog support: | |
``` | ||
For Gmail support: | ||
```yaml | ||
--- | ||
- hosts: all | ||
|
@@ -157,11 +188,14 @@ For Gmail support: | |
``` | ||
If you configure your Google account for extra security to use the 2-step verification, then | ||
postfix won't send out emails anymore and you might notice error messages in the /var/log/mail.log file | ||
postfix won't send out emails anymore and you might notice error messages in the `/var/log/mail.log` file | ||
|
||
To fix this issue, you need to visit the ([Authorizing applications & sites](http://www.google.com/accounts/IssuedAuthSubTokens?hide_authsub=1)) page under your Google Account settings. On this page enter the name of the application to be authorized (Postfix) and click on Generate button. Set the ```postfix_sasl_password``` variable with the password generated by this page. | ||
To fix this issue, you need to visit the ([Authorizing applications & sites](http://www.google.com/accounts/IssuedAuthSubTokens?hide_authsub=1)) | ||
page under your Google Account settings. On this page enter the name of the application to be authorized (Postfix) and click on Generate button. | ||
Set the `postfix_sasl_password` variable with the password generated by this page. | ||
|
||
A simple example that shows how to add some raw config: | ||
|
||
```yaml | ||
--- | ||
- hosts: all | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters