Added example playbook.

This commit is contained in:
chriswayg 2019-08-05 14:52:18 +08:00
parent 64c4aaf974
commit 3d6d248d57
1 changed files with 31 additions and 21 deletions

View File

@ -8,8 +8,10 @@ This ansible role deploys msmtp as a mailer for Debian, Ubuntu, Arch & Alpine Li
* Access to a functioning SMTP server. * Access to a functioning SMTP server.
## How to install ## How to install
* Use github to clone/fork into your role directory * Either use github to clone/dwonload into your roles directory:
* ansible galaxy ```ansible-galaxy install chriswayg.msmtp-mailer``` - `git clone https://github.com/chriswayg/ansible-etckeeper.git`
* Or use ansible galaxy:
- `ansible-galaxy install chriswayg.msmtp-mailer`
## Variables ## Variables
All the default variables are located **defaults/main.yml**. Mostly you would need to configure the following variables. All the default variables are located **defaults/main.yml**. Mostly you would need to configure the following variables.
@ -17,20 +19,20 @@ This ansible role deploys msmtp as a mailer for Debian, Ubuntu, Arch & Alpine Li
``` ```
msmtp_accounts: msmtp_accounts:
- account : gmail - account: gmail
host : smtp.gmail.com host: smtp.gmail.com
port : 587 port: 587
auth : "on" auth: "on"
from : example@gmail.example from: example@gmail.example
user : example@gmail.example user: example@gmail.example
password : "some password" password: "some password"
- account : mysmtp - account: mysmtp
host : smtp.example host: smtp.example
port : 587 port: 587
auth : "on" auth: "on"
from : admin@example.org from: admin@example.org
user : myuser@example.org user: myuser@example.org
password : plain-text-password2 password: plain-text-password2
``` ```
- *msmtp_default_account:* Default smtp account to use - *msmtp_default_account:* Default smtp account to use
@ -69,18 +71,26 @@ This ansible role deploys msmtp as a mailer for Debian, Ubuntu, Arch & Alpine Li
## Configure ## Configure
You can configure your variables in ansible with one of the following You can configure your variables in ansible with one of the following
* Create a variable in host/group variables directory. (recommended) * Create a variable in host/group variables directory.
* Editing var/main.yml * Editing vars/main.yml
* Run ansible-playbook with -e * Run ansible-playbook with -e
* Edit the default/main.yml (not recommended) * Edit the defaults/main.yml (not recommended)
## Example Playbook
```yaml
---
- hosts: all
roles:
- chriswayg.msmtp-mailer
```
## Run ## Run
**By default mstmp will work as the configuration uses a real smtp server (for testing only!)** **By default mstmp will function out of the box with the defaults/main.yml settings, because the configuration uses a real smtp server (for testing only!)**
```ansible-playbook -l hostname msmtp.yml``` ```ansible-playbook -l hostname msmtp.yml```
## Test ## Test
You should get a test mail if it works on the root mail You should get a test mail if it works as expected on the root mail
## Documentation ## Documentation
[msmtp manual](http://msmtp.sourceforge.net/doc/msmtp.html) [msmtp manual](http://msmtp.sourceforge.net/doc/msmtp.html)