Giter VIP home page Giter VIP logo

ansible-msmtp-mailer's Introduction

Build Status

#Luri's Modif They have some modification of initial rôle :

  • Support command set_from_header, allow_from_override and domain for each account
  • Remove obsolete command auto_from off and replace this with set_from_header and allow_from_override command
  • In each account, we not write empty command

ansible-msmtp-mailer

This ansible role deploys msmtp as a mailer for Debian, Ubuntu, Arch & Alpine Linux

Prerequisite

  • Access to a functioning SMTP server.

How to install

  • Either use github to clone/download into your roles directory:
    • git clone https://github.com/chriswayg/ansible-msmtp-mailer.git
  • Or use ansible galaxy:
    • ansible-galaxy install chriswayg.msmtp-mailer

Variables

All the default variables are located defaults/main.yml. Mostly you would need to configure the following variables.

  • msmtp_accounts: You can define one or more smtp accounts:

    msmtp_accounts:
    - account:   gmail
      host:      smtp.gmail.com
      port:      587
      auth:      "on"
      from:      [email protected]
      user:      [email protected]
      password:  "some password"
    - account:   mysmtp
      host:      smtp.example
      port:      587
      auth:      "on"
      from:      [email protected]
      user:      [email protected]
      password:  plain-text-password2
      tls_starttls: "off"
    
  • msmtp_default_account: Default smtp account to use

    msmtp_default_account: "gmail"

  • Logging

    • Option A (syslog)

       msmtp_log : "syslog"
      
    • Option B (file logging)

       msmtp_log     : "file"
       msmtp_logfile : /var/log/msmtp.log
      
    • Option C (No logging)

       msmtp_log     : "no"
      
  • Mail aliases

  • Configuration file permissions

    • msmtprc_owner: owner of /etc/msmtprc, default root

      msmtprc_owner : root

    • msmtprc_group: group of /etc/msmtprc, default root

      msmtprc_group : root

    • msmtprc_mode: group of /etc/msmtprc, default 0644

      msmtprc_mode : 0644

Configure

You can configure your variables in ansible with one of the following

  • Create a variable in host/group variables directory.
  • Editing vars/main.yml
  • Run ansible-playbook with -e
  • Edit the defaults/main.yml (not recommended)

Example Playbook

---
- hosts: all
  roles:
    - ansible-msmtp-mailer

Run

  • mstmp used to function out of the box with the provided defaults/main.yml settings, because the configuration used a real smtp server for testing, but Yandex does not allow this any more. Instead use a Gmail account for testing.

    ansible-playbook -l hostname msmtp.yml

Test

You should get a test mail if it works as expected on the root mail

Documentation

msmtp manual

Authors:

License:

  • Apache 2.0

ansible-msmtp-mailer's People

Contributors

chriswayg avatar ahelal avatar tomasz-kuzemko avatar angelix avatar xamanu avatar jpiron avatar luri-fr 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.