Skip to content

Instantly share code, notes, and snippets.

@dlundgren
Created May 9, 2016 13:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlundgren/3d4d616edfec95d4ab66d3156da1df1b to your computer and use it in GitHub Desktop.
Save dlundgren/3d4d616edfec95d4ab66d3156da1df1b to your computer and use it in GitHub Desktop.
vagrant+ansible mailhog php setup
description "Mailhog"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
pre-start script
exec su - vagrant -c "/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &"
end script
---
- name: Download MailHog
get_url:
url: https://github.com/mailhog/MailHog/releases/download/v0.1.8/MailHog_linux_amd64
dest: /usr/local/bin/mailhog
mode: 755
- name: Download mhsendmail
get_url:
url: https://github.com/mailhog/mhsendmail/releases/download/v0.1.9/mhsendmail_linux_amd64
dest: /usr/local/bin/mhsendmail
mode: 755
- name: Configure MailHog
copy:
src: files/mailhog.conf
dest: /etc/init/mailhog.conf
- name: Start mailhog
service:
name: mailhog
state: started
enabled: yes
- name: Configure PHP to use mailhog
copy:
src: files/php-sendmail.ini
dest: /etc/php5/mods-available/mhsendmail.ini
- name: Activate mhsendmail in PHP
command: php5enmod mhsendmail
sendmail_path = /usr/local/bin/mhsendmail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment