Skip to content

Commit

Permalink
Support ARM64 arch in Mailhog role
Browse files Browse the repository at this point in the history
`geerlingguy.mailhog` doesn't support arm64 (Apple Silicon) because the
underlying binaries (`mailhog` and `mhsendmail`) don't have official
`arm64` builds.

To support this by default, we need to override the url variables to
point to forks that have these builds.

This adds a new "shim loader" `mailhog` role which simply loads the
proper vars and then passes them to the included `geerlingguy.mailhog`
role.
  • Loading branch information
swalkinshaw committed Oct 14, 2022
1 parent 5fbd429 commit e9e16b0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ roles:
src: oefenweb.swapfile
version: v2.0.32

- name: mailhog
src: geerlingguy.mailhog
- src: geerlingguy.mailhog
version: 2.3.0
1 change: 1 addition & 0 deletions roles/mailhog/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mailhog_install_dir: /opt/mailhog
13 changes: 13 additions & 0 deletions roles/mailhog/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- ansible.builtin.include_vars:
file: "{{ item }}"
name: mailhog_overrides
with_first_found:
- files:
- "vars/{{ ansible_architecture }}.yml"
- "vars/default.yml"

- ansible.builtin.include_role:
name: geerlingguy.mailhog
vars:
mailhog_binary_url: "{{ mailhog_overrides.mailhog_binary_url }}"
mhsendmail_binary_url: "{{ mailhog_overrides.mhsendmail_binary_url }}"
2 changes: 2 additions & 0 deletions roles/mailhog/vars/aarch64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mailhog_binary_url: "https://github.com/jcalonso/MailHog/releases/download/v1.0.1-arm/MailHog.linux.arm64"
mhsendmail_binary_url: "https://github.com/evertiro/mhsendmail/releases/download/v0.2.0-M1/mhsendmail_linux_arm64"
2 changes: 2 additions & 0 deletions roles/mailhog/vars/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mailhog_binary_url: "https://github.com/mailhog/MailHog/releases/download/v{{ mailhog_version }}/MailHog_linux_{{ mailhog_arch }}"
mhsendmail_binary_url: "https://github.com/mailhog/mhsendmail/releases/download/v{{ mhsendmail_version }}/mhsendmail_linux_{{ mailhog_arch }}"

0 comments on commit e9e16b0

Please sign in to comment.