Changeset - 7ab6518de03b
[Not reviewed]
0 4 3
Branko Majic (branko) - 9 years ago 2015-04-07 23:02:36
branko@majic.rs
MAR-4: Implemented mail forwarder role, to be used for sending out mails via relay from the local system. Updated testsite to use mail forwarder role for the LDAP and XMPP servers.
7 files changed with 88 insertions and 0 deletions:
0 comments (0 inline, 0 general)
roles/mail_forwarder/handlers/main.yml
Show inline comments
 
new file 100644
 
---
 

	
 
- name: Purge Exim configuration
 
  apt: name="exim4*" state=absent purge=yes
 

	
 
- name: Rebuild mail aliases
 
  command: /usr/bin/newaliases
 

	
 
- name: Restart Postfix
 
  service: name="postfix" state="restarted"
 
\ No newline at end of file
roles/mail_forwarder/tasks/main.yml
Show inline comments
 
new file 100644
 
---
 

	
 
- name: Install Postfix
 
  apt: name="postfix" state=installed
 
  notify:
 
    - Purge Exim configuration
 

	
 
- name: Deploy Postfix main configuration
 
  template: src="main.cf.j2" dest="/etc/postfix/main.cf"
 
  notify:
 
    - Restart Postfix
 

	
 
- name: Set-up local mail aliases
 
  lineinfile:
 
    dest: "/etc/aliases"
 
    line: "{{ item.key }}: {{ item.value }}"
 
    regexp: "^{{ item.key }}"
 
    state: present
 
  with_dict: local_mail_aliases
 
  notify:
 
    - Rebuild mail aliases
roles/mail_forwarder/templates/main.cf.j2
Show inline comments
 
new file 100644
 
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
 

	
 

	
 
# Debian specific:  Specifying a file name will cause the first
 
# line of that file to be used as the name.  The Debian default
 
# is /etc/mailname.
 
#myorigin = /etc/mailname
 

	
 
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
 
biff = no
 

	
 
# appending .domain is the MUA's job.
 
append_dot_mydomain = no
 

	
 
# Uncomment the next line to generate "delayed mail" warnings
 
#delay_warning_time = 4h
 

	
 
readme_directory = no
 

	
 
# TLS parameters
 
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
 
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
 
smtpd_use_tls=yes
 
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
 
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
 

	
 
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
 
# information on enabling SSL in the smtp client.
 

	
 
myhostname = ansible
 
alias_maps = hash:/etc/aliases
 
alias_database = hash:/etc/aliases
 
myorigin = /etc/mailname
 
mydestination = {{ inventory_hostname }}, {{ inventory_hostname_short }}, localhost.localdomain, localhost
 
relayhost = {{ smtp_relay_host }}
 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128{% for network in smtp_mynetworks  %} {{ network }}{% endfor %}
 
mailbox_command = procmail -a "$EXTENSION"
 
mailbox_size_limit = 0
 
recipient_delimiter = +
testsite/group_vars/ldap.yml
Show inline comments
 
---
 

	
 
local_mail_aliases:
 
  root: "root john.doe@example.com"
 

	
 
smtp_mynetworks:
 
  - mail.example.com
 

	
 
smtp_relay_host: mail.example.com
 

	
 
ldap_client_config:
 
  - comment: Set the base DN
 
    option: BASE
testsite/group_vars/xmpp.yml
Show inline comments
 
@@ -14,6 +14,14 @@ ldap_client_config:
 
    option: TLS_CACERT
 
    value: /etc/ssl/certs/truststore.pem
 

	
 
local_mail_aliases:
 
  root: "root john.doe@example.com"
 

	
 
smtp_mynetworks:
 
  - mail.example.com
 

	
 
smtp_relay_host: mail.example.com
 

	
 
prosody_administrators:
 
  - john.doe@example.com
 

	
testsite/playbooks/ldap.yml
Show inline comments
 
@@ -5,5 +5,6 @@
 
  sudo: yes
 
  roles:
 
    - common
 
    - mail_forwarder
 
    - ldap_client
 
    - ldap_server
testsite/playbooks/xmpp.yml
Show inline comments
 
@@ -6,4 +6,5 @@
 
  roles:
 
    - common
 
    - ldap_client
 
    - mail_forwarder
 
    - prosody
0 comments (0 inline, 0 general)