ansible-msmtp-mailer/README.md

109 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

2018-05-07 15:21:39 +00:00
[![Build Status](https://travis-ci.org/chriswayg/ansible-msmtp-mailer.svg?branch=master)](https://travis-ci.org/chriswayg/ansible-msmtp-mailer)
2018-04-28 18:36:01 +00:00
2019-08-06 09:39:32 +00:00
# ansible-msmtp-mailer
2014-03-21 19:16:55 +00:00
2021-05-15 15:31:16 +00:00
This ansible role deploys msmtp as a mailer for RHEL8 and compatible.
2014-03-21 19:16:55 +00:00
2018-04-28 18:36:01 +00:00
## Prerequisite
2018-05-07 14:38:25 +00:00
* Access to a functioning SMTP server.
2014-03-21 19:16:55 +00:00
2018-04-28 18:36:01 +00:00
## How to install
2022-08-08 20:31:23 +00:00
* Either use git to clone/download into your roles directory:
- `git clone https://git.garbaye.fr/Garbaye/ansible-msmtp-mailer.git`
2021-05-15 15:31:16 +00:00
* Or import in your requirements.yml:
```
roles:
2022-08-08 20:31:23 +00:00
- src: git+https://git.garbaye.fr/Garbaye/ansible-msmtp-mailer.git
2021-05-15 15:31:16 +00:00
```
2014-03-21 19:16:55 +00:00
2018-04-28 18:36:01 +00:00
## Variables
All the default variables are located **defaults/main.yml**. Mostly you would need to configure the following variables.
2018-05-07 14:28:10 +00:00
- *msmtp_accounts:* You can define one or more smtp accounts:
2014-03-21 19:16:55 +00:00
```
msmtp_accounts:
2019-08-05 06:52:18 +00:00
- account: gmail
host: smtp.gmail.com
port: 587
auth: "on"
from: example@gmail.example
user: example@gmail.example
password: "some password"
- account: mysmtp
host: smtp.example
port: 587
auth: "on"
from: admin@example.org
user: myuser@example.org
password: plain-text-password2
2014-03-21 19:16:55 +00:00
```
- *msmtp_default_account:* Default smtp account to use
2014-03-21 19:16:55 +00:00
```msmtp_default_account: "gmail"```
- Logging
2014-03-21 19:16:55 +00:00
- 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"
```
2014-03-21 19:36:47 +00:00
- Mail aliases
- *msmtp_alias_default:* default email this required
2014-03-21 19:16:55 +00:00
2018-05-07 14:38:25 +00:00
`msmtp_alias_default : ops@example.com`
2014-03-21 19:16:55 +00:00
- *msmtp_alias_root:* root email this is optional
2018-05-07 14:38:25 +00:00
`msmtp_alias_root : root@example.com`
2014-03-21 19:16:55 +00:00
- *msmtp_alias_cron:* cron email this optional
2018-05-07 14:38:25 +00:00
`msmtp_alias_cron : cron@example.com`
2014-03-21 19:16:55 +00:00
2018-04-28 18:36:01 +00:00
## Configure
2014-03-21 19:16:55 +00:00
You can configure your variables in ansible with one of the following
2019-08-05 06:52:18 +00:00
* Create a variable in host/group variables directory.
* Editing vars/main.yml
2014-03-21 19:16:55 +00:00
* Run ansible-playbook with -e
2019-08-05 06:52:18 +00:00
* Edit the defaults/main.yml (not recommended)
## Example Playbook
```yaml
---
- hosts: all
roles:
2019-08-06 09:39:32 +00:00
- ansible-msmtp-mailer
2019-08-05 06:52:18 +00:00
```
2014-03-21 19:16:55 +00:00
2018-04-28 18:36:01 +00:00
## 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.
2014-03-21 19:23:28 +00:00
```ansible-playbook -l hostname msmtp.yml```
2014-03-21 19:16:55 +00:00
2018-04-28 18:36:01 +00:00
## Test
2019-08-05 06:52:18 +00:00
You should get a test mail if it works as expected on the root mail
2014-03-21 19:16:55 +00:00
2018-05-07 14:28:10 +00:00
## Documentation
[msmtp manual](http://msmtp.sourceforge.net/doc/msmtp.html)
2019-08-05 07:36:36 +00:00
## Authors:
2021-05-15 15:31:16 +00:00
- Forked from [GitHub - chriswayg/ansible-msmtp-mailer](https://github.com/chriswayg/ansible-msmtp-mailer)
2019-08-05 07:36:36 +00:00
- Forked from [GitHub - AutomationWithAnsible/ansible-msmtp: Ansible MSTMP](https://github.com/AutomationWithAnsible/ansible-msmtp)
2019-08-06 09:39:32 +00:00
- By [Adham Helal](https://github.com/ahelal)
2019-08-05 07:36:36 +00:00
- [Christian Wagner](https://github.com/chriswayg)
## License:
- Apache 2.0