Initial msmtp implementation
This commit is contained in:
parent
f7420219ee
commit
1c4b0e8cf8
13
roles/msmtp/defaults/main.yml
Normal file
13
roles/msmtp/defaults/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
#######################################
|
||||
# General settings
|
||||
#######################################
|
||||
|
||||
# E-mail address for notifications
|
||||
msmtp_email_address: "user@domain.tld"
|
||||
|
||||
# SMTP server config options
|
||||
msmtp_smtp_server: "email.domain.tld"
|
||||
msmtp_smtp_from: "user@domain.tld"
|
||||
msmtp_smtp_user: "user@domain.tld"
|
||||
msmtp_smtp_password: "password"
|
40
roles/msmtp/tasks/main.yml
Normal file
40
roles/msmtp/tasks/main.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
- name: Gather instance facts
|
||||
setup:
|
||||
- name: Update APT package cache
|
||||
apt:
|
||||
update_cache: "{{ wireguard_ubuntu_update_cache }}"
|
||||
cache_valid_time: "{{ wireguard_ubuntu_cache_valid_time }}"
|
||||
tags:
|
||||
- msmtp-install
|
||||
- name: Install msmtp
|
||||
package:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- msmtp
|
||||
- msmtp-mta
|
||||
- ca-certificates
|
||||
tags:
|
||||
- msmtp-install
|
||||
|
||||
- block:
|
||||
- name: Generate msmtp configuration file
|
||||
template:
|
||||
src: msmtp
|
||||
dest: "/etc/msmtprc"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
tags:
|
||||
- msmtp-config
|
||||
- name: Generate aliases configuration file
|
||||
template:
|
||||
src: aliases
|
||||
dest: "/etc/aliases"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
tags:
|
||||
- msmtp-config
|
10
roles/msmtp/templates/aliases
Normal file
10
roles/msmtp/templates/aliases
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Example aliases file
|
||||
|
||||
# Send root to Joe and Jane
|
||||
root: {{ msmtp_email_address }}
|
||||
|
||||
# Send cron to Mark
|
||||
cron: {{ msmtp_email_address }}
|
||||
|
||||
# Send everything else to admin
|
||||
default: {{ msmtp_email_address }}
|
22
roles/msmtp/templates/msmtprc
Normal file
22
roles/msmtp/templates/msmtprc
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Accounts will inherit settings from this section
|
||||
defaults
|
||||
auth on
|
||||
tls on
|
||||
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
logfile /var/log/msmtp.log
|
||||
|
||||
from {{ msmtp_smtp_from }}
|
||||
keepbcc on
|
||||
|
||||
account piframe
|
||||
host {{ msmtp_smtp_server }}
|
||||
port 587
|
||||
auth on
|
||||
user {{ msmtp_smtp_user }}
|
||||
password {{ msmtp_smtp_password }}
|
||||
|
||||
# Set a default account
|
||||
account default : piframe
|
||||
|
||||
aliases /etc/aliases
|
Loading…
Reference in a new issue