Compare commits

...

2 commits

Author SHA1 Message Date
KemoNine 816a3dfd38 Tweak software update playbook/run script 2020-08-04 22:54:13 +00:00
KemoNine 1c4b0e8cf8 Initial msmtp implementation 2020-08-04 22:51:58 +00:00
6 changed files with 92 additions and 1 deletions

View file

@ -0,0 +1,6 @@
#!/bin/bash
# https://www.tauceti.blog/post/kubernetes-the-not-so-hard-way-with-ansible-wireguard/
# https://github.com/githubixx/ansible-role-wireguard
ansible-playbook -u ansible --private-key /opt/ansible/ssh.key -i inventory ./update-software.yml

View 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"

View 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

View 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 }}

View 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

View file

@ -1,5 +1,5 @@
--- ---
- hosts: all - hosts: frames
become: yes become: yes
tasks: tasks:
- name: Refresh package list - name: Refresh package list