mirror of
https://github.com/pigmonkey/spark.git
synced 2026-01-23 02:24:09 +00:00
forward system mail to user
This commit is contained in:
parent
ff0c73b15d
commit
72a5591aec
6 changed files with 55 additions and 3 deletions
|
|
@ -61,6 +61,12 @@ AUR packages are installed via the [ansible-aur][7] module. Note that while
|
|||
[aura][8], an [AUR helper][9], is installed by default, it will *not* be used
|
||||
during any of the provisioning.
|
||||
|
||||
## System Mail
|
||||
|
||||
If the `email.user` variable is defined, the system will be configured to
|
||||
forward mail for the user and root to this address. Removing this variable will
|
||||
cause no mail aliases to be put in place.
|
||||
|
||||
## Known Issues
|
||||
|
||||
* [tpfanco][10], normally installed as part of the `thinkpad` role is currently
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ user:
|
|||
name: pigmonkey
|
||||
group: pigmonkey
|
||||
shell: /usr/bin/zsh
|
||||
email: peter@havenaut.net
|
||||
|
||||
dotfiles:
|
||||
url: git@github.com:pigmonkey/dotfiles.git
|
||||
|
|
|
|||
3
roles/mail/files/cronie-service-msmtp.conf
Normal file
3
roles/mail/files/cronie-service-msmtp.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/crond -n -m '/usr/bin/msmtp -t'
|
||||
1
roles/mail/files/msmtprc
Normal file
1
roles/mail/files/msmtprc
Normal file
|
|
@ -0,0 +1 @@
|
|||
aliases /etc/aliases
|
||||
|
|
@ -12,10 +12,8 @@
|
|||
- name: Install OfflineIMAP
|
||||
pacman: name=offlineimap state=present
|
||||
|
||||
- name: Install msmtp
|
||||
pacman: name=msmtp-mta state=present
|
||||
|
||||
- name: Install notmuch
|
||||
pacman: name=notmuch state=present
|
||||
|
||||
- include: msmtp.yml
|
||||
- include: contacts.yml
|
||||
|
|
|
|||
43
roles/mail/tasks/msmtp.yml
Normal file
43
roles/mail/tasks/msmtp.yml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
- name: Install msmtp
|
||||
pacman: name=msmtp-mta state=present
|
||||
tags:
|
||||
- msmtp
|
||||
|
||||
- name: Push msmtp configuration file
|
||||
copy: src=msmtprc dest=/etc/msmtprc
|
||||
tags:
|
||||
- msmtp
|
||||
|
||||
- name: Verify alias file exists
|
||||
file: path=/etc/aliases state=touch
|
||||
tags:
|
||||
- msmtp
|
||||
|
||||
- name: Set root email alias
|
||||
lineinfile: "dest=/etc/aliases
|
||||
regexp=^root
|
||||
state=present
|
||||
line='root: {{ user.email }}'"
|
||||
when: user.email
|
||||
tags:
|
||||
- msmtp
|
||||
|
||||
- name: Set user email alias
|
||||
lineinfile: "dest=/etc/aliases
|
||||
regexp=^{{ user.name }}
|
||||
state=present
|
||||
line='{{ user.name }}: {{ user.email }}'"
|
||||
when: user.email
|
||||
tags:
|
||||
- msmtp
|
||||
|
||||
- name: Create cronie systemd unit file directory
|
||||
file: path=/etc/systemd/system/cronie.service.d state=directory
|
||||
tags:
|
||||
- msmtp
|
||||
|
||||
- name: Override cronie send mail via msmtp
|
||||
copy: src=cronie-service-msmtp.conf dest=/etc/systemd/system/cronie.service.d/msmtp.conf
|
||||
tags:
|
||||
- msmtp
|
||||
Loading…
Add table
Add a link
Reference in a new issue