Giter VIP home page Giter VIP logo

role-mailrelay's Introduction

Ansible Role postfix mailrelay

This role installs and configures a postfix mailrelay.

Ofter times, applications or services will want to send out e-mails. This role will configure any such server to queue mails locally and then forwarding them to any specific mail-relay.

This way, applications and services on such a configured instance don't require any special send/relay/bounce logic and can simply use mail-drop to reliably send out e-mails.

The variables used by this role should be self-explanatory for anyone with a Postfix background.

Example play

- hosts: mx-relays
  vars:
    mailrelay_default_sender_email: "[email protected]"
    mailrelay_default_sender_user: "ServerExampleCom"
    mailrelay_default_sender_password: "verylongpassword"
    mailrelay_default_sender_server: "smtp.gmail.com"
    mailrelay_default_sender_server_port: "587"
    mailrelay_default_monitoring_recipient: "[email protected]"
    
    # Set to False to disable or to '[email protected]' to receive bounce mails
    mailrelay_bounce_notice_recipient: False
    
    # Sending address to sending server association
    mailrelay_relayhost_maps:
      - name: "{{ mailrelay_default_sender_email }}"
        target: "[{{ mailrelay_default_sender_server }}]:{{ mailrelay_default_sender_server_port }}"
      - name: "[email protected]"
        target: "[smtp.gmail.com]:587"
    
    # Sending address - user:password association
    mailrelay_sasl_passwords:
      - name: "{{ mailrelay_default_sender_email }}"
        target: "{{ mailrelay_default_sender_user }}:{{ mailrelay_default_sender_password }}"
      - name: "[email protected]"
        target: "SubscribeExampleCom:secretpass"
    
    # Sending Linux user - sender address rewriting, http://www.postfix.org/ADDRESS_REWRITING_README.html
    mailrelay_sender_canonical_maps:
      # Note that it "seems" possible to rewrite every account using a regex like:
      # /etc/postfix/sender-canonical-maps.regex
      # /.*/    [email protected]
      # However this calls for some unexpected behavior and loops with mails to [email protected] and so on, so I don't recommend it
      - name: "root"
        target: "{{ mailrelay_default_sender_email }}"
      - name: "www_example_com"
        target: "{{ mailrelay_default_sender_email }}"
    
    # When those linux users receive
    mailrelay_aliases:
      # Relay mails to the root use to the default_monitoring_recipient
      - name: root
        target: "{{mailrelay_default_monitoring_recipient }}"

  roles:
    - blunix.role-mailrelay

License

Apache-2.0

License

Apache-2.0

Author Information

All changes from 2019-05-31 onwards:

Programmfabrik GmbH,
Schwedter Str. 9b,
10119 Berlin

All changes until 2019-05-30 by:

Service and support for orchestrated hosting environments, continuous integration/deployment/delivery and various Linux and open-source technology stacks are available from:

Blunix GmbH - Consulting for Linux Hosting 24/7
Glogauer Straße 21
10999 Berlin - Germany

Web: www.blunix.org
Email: service[at]blunix.org
Phone: (+49) 30 / 12 08 39 90

role-mailrelay's People

Contributors

baccenfutter avatar klausthornprogrammfabrik avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.