-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added postfix_files feature as a simple means to add extra files/maps…
… to the postfix config
- Loading branch information
1 parent
9f52769
commit 73b7c72
Showing
4 changed files
with
84 additions
and
0 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 |
---|---|---|
|
@@ -67,6 +67,21 @@ postfix_conf: | |
relayhost: example.com | ||
``` | ||
|
||
### postfix_files | ||
|
||
```yaml | ||
postfix_files: | ||
- name: sasl_passwd | ||
content: example.com user:password | ||
postmap: true | ||
- name: sender_canonical_maps | ||
content: /.+/ [email protected] | ||
``` | ||
|
||
This is a list of files that will be placed in /etc/postfix and that can be converted into Postfix Lookup Tables if needed. | ||
|
||
It's meant as a simple mechanism to configure things such as SASL credentials and other small snippets. | ||
|
||
### postfix_check | ||
|
||
```yaml | ||
|
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 |
---|---|---|
|
@@ -6,6 +6,15 @@ | |
# | ||
postfix_conf: {} | ||
|
||
# Additional config maps/files, e.g.: | ||
# postfix_files: | ||
# - name: 'sasl_passwd' | ||
# content: 'smtp.example.com [email protected]:myFirstPassword | ||
# postmap: true | ||
# - name: 'sender_canonical_maps' | ||
# content: '/.+/ [email protected]' | ||
postfix_files: [] | ||
|
||
# Whether to run 'postfix check' before it's started | ||
postfix_check: true | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- name: Create a postmapped file | ||
hosts: all | ||
|
||
vars: | ||
postfix_files: | ||
- name: test | ||
content: test | ||
postmap: true | ||
|
||
tasks: | ||
- name: Run the role with test postmap file | ||
include_role: | ||
name: linux-system-roles.postfix | ||
public: true | ||
|
||
- name: Check if postmap file exists | ||
stat: | ||
path: /etc/postfix/test.db | ||
register: test_file | ||
changed_when: false | ||
|
||
- name: Assert file is present | ||
assert: | ||
that: test_file.stat.exists | ||
|
||
- name: Clean up test files | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
loop: | ||
- /etc/postfix/test | ||
- /etc/postfix/test.db |