ansibleguy.sw_mailcow
<a href="https://mailcow.email/">
<img src="https://www.servercow.de/img/cow_mailcow.svg" alt="MailCow Logo" width="300"/>
</a>
# Ansible Role - MailCow
This role is for setting up [MailCow dockerized](https://github.com/mailcow/mailcow-dockerized) on a Linux server.
It follows the official [installation instructions](https://mailcow.github.io/mailcow-dockerized-docs/de/i_u_m/i_u_m_install/).
<a href='https://ko-fi.com/ansible0guy' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy me a coffee' /></a>
[](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2)
[](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/yamllint.sh.j2)
[](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/pylint.sh.j2)
[](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/ansiblelint.sh.j2)
[](https://galaxy.ansible.com/ui/standalone/roles/ansibleguy/sw_mailcow)
Molecule Logs: [Short](https://badges.ansibleguy.net/log/molecule_sw_mailcow_test_short.log), [Full](https://badges.ansibleguy.net/log/molecule_sw_mailcow_test.log)
**Tested on:**
* Debian 11
## Installation
```bash
# To install the latest version
ansible-galaxy role install git+https://github.com/ansibleguy/sw_mailcow
# To install from Ansible Galaxy
ansible-galaxy install ansibleguy.sw_mailcow
# Or, to install in a custom path
ansible-galaxy install ansibleguy.sw_mailcow --roles-path ./roles
# Install dependencies
ansible-galaxy install -r requirements.yml
Prerequisites
See: Prerequisites
Usage
Want a simple Ansible GUI? Check out my Ansible WebUI.
Configuration
Set the configuration as needed:
mailcow:
fqdn: 'srv.template.ansibleguy.net'
# 'srv.template.ansibleguy.net' must be a valid, public DNS hostname of the server
# Set to false if you don't have IPv6
ipv6: false
nginx: # Configure web server settings
aliases: ['mail.template.ansibleguy.net'] # Additional domains for the certificate
ssl:
mode: 'letsencrypt' # Options: selfsigned/ca/snakeoil
# For 'selfsigned' or 'ca', provide:
# cert:
# cn: 'MailCow Server'
# org: 'AnsibleGuy'
# email: '[email protected]'
letsencrypt:
email: '[email protected]'
config: # Add overrides for 'mailcow.conf'
WEBAUTHN_ONLY_TRUSTED_VENDORS: 'y'
auto_update:
enable: true # Enable automatic updates
backup:
retention_days: 60 # Default = 14 days
Minimum example:
mailcow:
fqdn: 'srv.template.ansibleguy.net'
If you want to use the built-in (not managed by Ansible) web server:
mailcow:
fqdn: 'srv.template.ansibleguy.net'
# 'srv.template.ansibleguy.net' must be a valid, public DNS hostname of the server
manage:
webserver: false
config:
HTTP_PORT: 80
HTTPS_PORT: 443
# Use the built-in letsencrypt support
SKIP_LETS_ENCRYPT: 'n'
ACME_CONTACT: '[email protected]'
ADDITIONAL_SAN: 'smtp.template.ansibleguy.net,mail.*'
Execution
Run the playbook:
ansible-playbook -K -D -i inventory/hosts.yml playbook.yml
Useful tags:
- docker
- webserver
To debug errors, set the 'debug' variable at runtime:
ansible-playbook -K -D -i inventory/hosts.yml playbook.yml -e debug=yes
Functionality
Package Installation
- Minimal Ansible dependencies
Configuration
Service to start containers on boot: 'mailcow.service'
Default config:
- Directories:
- Base: '/var/lib/mailcow'
- Data: '/var/lib/docker/volumes' (cannot be changed by the role)
- Backup: '/var/backups/mailcow'
- Directories:
Default options:
Docker using THIS Role
- Dependencies
- Server
- Docker-compose
Nginx proxy on Docker host using THIS Role
Features:
- SOGo Groupware
- Apache Solr
- ClamAV (virus scanner)
IPv6 enabled
Daily backup using the backup script
Default opt-outs:
- Auto update using the update script
Additional Information
Note: Consider a Mail Gateway for better Security! For instance: Proxmox Mail Gateway.
Note: Check out the troubleshooting information: Troubleshooting.
Note: This role only supports Debian-based systems.
Note: You can choose to enable or disable most features.
For all available options, check the default config in the main defaults-file.
Warning: Not all settings/variables will be checked for correctness. Incorrect config may break the role!
Info: Default login credentials:
User: admin
Password: moohoo
Info: For more detailed information, refer to the documentation provided by MailCow.
Info: If the setup fails after creating the config, you will need to manually delete the config file (/var/lib/mailcow/mailcow.conf) for the role to recognize it isn't initialized.
Warning: The automatic BACKUPS are stored on the same system; copy them to a REMOTE location for safety!
```
Ansible role to deploy MailCow dockerized on a linux server
ansible-galaxy install ansibleguy.sw_mailcow