buluma.mailhog
Ansible role mailhog
MailHog for Linux
| GitHub | Version | Issues | Pull Requests | Downloads |
|---|---|---|---|---|
Example Playbook
This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.
---
- name: Converge
hosts: all
become: false
pre_tasks:
- name: Update apt cache.
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
- name: Ensure build dependencies are installed (RedHat).
ansible.builtin.package:
name:
- "@Development tools"
- tar
- unzip
- net-tools
- curl
state: present
when: ansible_os_family == 'RedHat'
- name: Ensure build dependencies are installed (Debian).
ansible.builtin.apt:
name:
- build-essential
- tar
- unzip
- net-tools
- curl
state: present
when: ansible_os_family == 'Debian'
roles:
- buluma.daemonize
- buluma.mailhog
post_tasks:
- name: Copy test message into place.
ansible.builtin.copy:
src: test-message
dest: /tmp/test-message
mode: 0644
- name: Send an email via mhsendmail.
shell: cat /tmp/test-message | /opt/mailhog/mhsendmail [email protected]
changed_when: false
- name: Test retrieiving messages from the MailHog API.
ansible.builtin.uri:
url: http://localhost:8025/api/v2/messages
register: result
until: result.status == 200
retries: 60
delay: 1
The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:
---
- name: Prepare
hosts: all
become: true
gather_facts: false
roles:
- role: buluma.bootstrap
Also see a full explanation and example on how to use these roles.
Role Variables
The default values for the variables are set in defaults/main.yml:
---
mailhog_install_dir: /opt/mailhog
mailhog_version: "1.0.0"
mailhog_binary_url: "https://github.com/mailhog/MailHog/releases/download/v{{ mailhog_version }}/MailHog_linux_amd64"
mhsendmail_version: "0.2.0"
mhsendmail_binary_url: "https://github.com/mailhog/mhsendmail/releases/download/v{{ mhsendmail_version }}/mhsendmail_linux_amd64"
# Path to daemonize, which is used to launch MailHog via init script.
mailhog_daemonize_bin_path: /usr/sbin/daemonize
Requirements
- pip packages listed in requirements.txt.
State of used roles
The following roles are used to prepare a system. You can prepare your system in another way.
| Requirement | GitHub | Version |
|---|---|---|
| buluma.bootstrap | ||
| buluma.daemonize |
Dependencies
Most roles require some kind of preparation, this is done in molecule/default/prepare.yml. This role has a "hard" dependency on the following roles:
- {'role': 'buluma.daemonize'}
Context
This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.
Here is an overview of related roles:

Compatibility
This role has been tested on these container images:
| container | tags |
|---|---|
| EL | 8, 9 |
| Ubuntu | all |
| Debian | all |
The minimum version of Ansible required is 2.4, tests have been done to:
- The previous version.
- The current version.
- The development version.
If you find issues, please register them in GitHub
Changelog
License
Author Information
ansible-galaxy install buluma.mailhog