Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Postfix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Infrastructure
Ansible Roles
Postfix
Commits
0790d342
Commit
0790d342
authored
Jun 30, 2018
by
Chris Coley
Browse files
Options
Downloads
Patches
Plain Diff
Update the README
parent
256fdf4d
Branches
refactor-to-improve-flexibility
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+106
-0
106 additions, 0 deletions
README.md
with
106 additions
and
0 deletions
README.md
0 → 100644
+
106
−
0
View file @
0790d342
Postfix
=========
This role installs Postfix and allows basic configuration.
Requirements
------------
This role requires Ansible 2.4 or higher.
Role Variables
--------------
| Variable | Default | Purpose |
|----------|---------|---------|
| postfix__recommended_packages |
`[]`
| Additional packages to install. These packages will have default configuration. |
| postfix__mailname |
`{{ ansible_fqdn }}`
| The name of the mail system. |
| postfix__tables | empty | Dictionaries used to build lookup tables.
[
Details below.
](
#postfix__tables
)
|
| postfix__main_cf |
`{}`
| Used to modify or add lines in the main.cf file.
[
Details below.
](
#postfix__main_cf
)
|
### `postfix__tables`
This dictionary contains nested dictionaries that are used to build the lookup
tables with the corresponding name. So
`postfix__tables.transport`
is used to
build the transport lookup table,
`postfix__tables.sasl_passwd`
is used to build
the SASL password map table, etc. Within each dictionary the 'key' is the lookup
pattern and the 'value' is the returned value.
For example, this
`postfix__tables.transport`
dictionary:
```
yaml
postfix__tables
:
transport
:
'
internal.domain.tld'
:
'
:'
'
*'
:
'
discard:'
```
would result in the following transport table:
```
internal.domain.tld :
* discard:
```
This role currently only supports the transport lookup table and the SASL lookup
table. More information on the transport table format can be found
[
here
][
transport-docs
]
and more information on the SASL passwords lookup table
format can be found
[
here.
][
sasl-passwd-docs
]
### `postfix__main_cf`
This dictionary is used to add or modify lines in the main.cf file. Each key
corresponds to a parameter in main.cf, and the value is what the parameter
should be set to. If the parameter already exists in the file, then that line
will be replaced. Otherwise, a new line will be added at the end of the file.
This dictionary is merged with the internal
`postfix__main_cf_default`
dictionary which defines some reasonable defaults, such as enabling
opportunistic TLS for the SMTP client. All keys in
`postfix__main_cf_default`
can be overridden in
`postfix__main_cf`
.
Example Playbooks
----------------
This example configures Postfix to accept mail on the loopback interface and
relay it to Mailgun's SMTP servers. It also uses SASL + TLS to authenticate with
Mailgun.
```
yaml
-
hosts
:
servers
tasks
:
-
include_role
:
name
:
postfix
vars
:
postfix__main_cf
:
inet_interfaces
:
loopback-only
relayhost
:
'
[smtp.mailgun.org]:587'
smtp_sasl_auth_enable
:
'
yes'
smtp_tls_security_level
:
encrypt
smtp_sasl_tls_security_options
:
noanonymous
postfix__tables
:
sasl_passwd
:
'
[smtp.mailgun.org]:587'
:
'
USERNAME:PASSWORD'
```
Another common configuration when doing development is to filter all mail so
that only mail sent to your internal domain is actually sent. All other mail
will be dropped silently to prevent accidentally sending emails when developing
against real data. You can do that using transport maps
```
yaml
-
hosts
:
servers
tasks
:
-
include_role
:
name
:
postfix
vars
:
postfix__tables
:
transport
:
'
internal.domain.tld'
:
'
:'
'
*'
:
'
discard:'
```
[
transport-docs
]:
http://www.postfix.org/transport.5.html
[
sasl-passwd-docs
]:
http://www.postfix.org/SASL_README.html#client_sasl_sender
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment