-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Install and configure postfix. - Add empty line. - Change restart to reload. - Add postmap, addresses, aliases and create folders. - Install and configure postfix. - Add empty line. - Rename postfix-service to postfix-handlers. - Use postfix reload instead of service reload feature. - Move postfix to webservers. - Add virtual_alias_maps to postfix playbook. - Move all from common to web folder. Fixes #6 Closes #33
- Loading branch information
Showing
5 changed files
with
58 additions
and
2 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
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,11 @@ | ||
--- | ||
|
||
- name: Reload postfix | ||
command: /usr/sbin/postfix reload | ||
|
||
- name: Postmap addresses | ||
command: postmap /etc/postfix/virtual/addresses | ||
notify: Reload postfix | ||
|
||
- name: Restart postfix | ||
action: service name=postfix state=restarted |
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,43 @@ | ||
--- | ||
|
||
- name: Install postfix | ||
apt: name=postfix state=installed | ||
|
||
- name: Ensure that postfix is started and enabled on boot | ||
service: name=postfix state=started enabled=yes | ||
|
||
- name: Set mailname | ||
copy: dest=/etc/mailname content={{ inventory_hostname }} | ||
|
||
- name: Configure postfix | ||
lineinfile: | ||
regexp='{{ item.regexp }}' backrefs=yes line='{{ item.line }}' dest=/etc/postfix/main.cf | ||
with_items: | ||
- { regexp: '^#myorigin = /etc/mailname', line: 'myorigin = /etc/mailname' } | ||
- { regexp: '^myhostname', line: 'myhostname = {{ inventory_hostname }}' } | ||
- { regexp: '^mydestination', line: 'mydestination = $myhostname, /etc/postfix/virtual/domains, localhost, localhost.localdomain, localhost' } | ||
notify: Restart postfix | ||
|
||
- name: Remove lines from postfix | ||
lineinfile: | ||
regexp='{{ item.regexp }}' backrefs=yes dest=/etc/postfix/main.cf state=absent | ||
with_items: | ||
- { regexp: '^alias_maps' } | ||
- { regexp: '^alias_database' } | ||
notify: Reload postfix | ||
|
||
- name: Add virtual_alias_maps line | ||
lineinfile: line='virtual_alias_maps = hash:/etc/postfix/virtual/addresses' | ||
dest=/etc/postfix/main.cf | ||
notify: Reload postfix | ||
|
||
- name: Ensure that Postfix virtual folder exsists | ||
file: path=/etc/postfix/virtual state=directory | ||
|
||
- name: Configure addresses for postfix | ||
copy: src=web/postfix/addresses dest=/etc/postfix/virtual/addresses | ||
notify: Postmap addresses | ||
|
||
- name: Configure domains for postfix | ||
copy: src=web/postfix/domains dest=/etc/postfix/virtual/domains | ||
notify: Reload postfix |
Empty file.
Empty file.