kevintde / ansible-mail-server

Production grade email server setup with only one command...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ansible playbook to setup a mail server

This is an Ansible-Playbook for the great mail server setup described in this tutorial: https://thomas-leister.de/mailserver-debian-stretch/ written by Thomas Leister.

Requirements

  • Ansible >= 2.7
  • Server with Debian Bullseye operating system (the installation on Ubuntu will also work, but is not tested)
  • SSH key to login to the server
  • Public domain resolving to the server

Configuration

Inventory

Set the hostname in the inventory file hosts

Variables

All variables are stored in the vars file. Set the values according to your server.

Credentials

Credentials are stored in the vault.yml. The Password is "vault". Please change the password with ansible-vault rekey group_vars/all/vault.yml.

  • Database user: "vmail", pass: "vmail" (Please change it)
  • Mail user: "mail", pass: "mail" (Please change it)
  • Rspam admin password: "rspamadmpw"

Run the playbook

ansible-playbook -i ./hosts site.yml --ask-vault-pass

Test

Molecule

The results of the ansible playbook can be tested with Molecule

Test with molecule

Build the mail server

ANSIBLE_VAULT_PASSWORD_FILE=<YOUR_VAULT_PASS_FILE_PATH> molecule converge

Verify the installation

ANSIBLE_VAULT_PASSWORD_FILE=<YOUR_VAULT_PASS_FILE_PATH> molecule verify

Build, test and destroy in one command

ANSIBLE_VAULT_PASSWORD_FILE=<YOUR_VAULT_PASS_FILE_PATH> molecule test

Bats

Send a email on the ready system with bats

mail_user=USER mail_pass=PASS mail_host=HOST:587 bats smtp.bats

About

Production grade email server setup with only one command...


Languages

Language:Jinja 79.1%Language:jq 8.9%Language:Sieve 4.0%Language:Shell 2.6%Language:JSONiq 2.3%Language:NASL 2.2%Language:C++ 0.8%