-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from palantirnet/drupalbox/mailhog
Adds mailhog role
- Loading branch information
Showing
8 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ This project adheres to [Semantic Versioning](http://semver.org/). | |
### Added | ||
|
||
- Memcached role | ||
- Mailhog role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require_relative 'spec_helper' | ||
|
||
%w{mailhog mhsendmail}.each do |name| | ||
describe command("which #{name}") do | ||
its(:exit_status) { should eq 0 } | ||
end | ||
end | ||
|
||
describe process("mailhog") do | ||
it { should be_running } | ||
its(:user) { should eq "mailhog" } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
mailhog_version: v0.2.0 | ||
mailhog_user: mailhog | ||
mailhog_group: mailhog | ||
mailhog_home_dir: /usr/local/mailhog | ||
mailhog_binary_url: "https://github.com/mailhog/MailHog/releases/download/{{ mailhog_version}}/MailHog_linux_amd64" | ||
mhsendmail_binary_url: "https://github.com/mailhog/mhsendmail/releases/download/{{ mailhog_version }}/mhsendmail_linux_amd64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
|
||
- name: Mailhog | Create Mailhog Group | ||
become: yes | ||
group: | ||
name: "{{ mailhog_group }}" | ||
system: yes | ||
state: present | ||
tags: mailhog | ||
|
||
- name: Mailhog | Create Mailhog User | ||
become: yes | ||
user: | ||
name: "{{ mailhog_user }}" | ||
group: "{{ mailhog_group }}" | ||
home: "{{ mailhog_home_dir }}" | ||
system: yes | ||
shell: /usr/sbin/nologin | ||
state: present | ||
tags: mailhog | ||
|
||
- name: Mailhog | Create Mailhog Directories | ||
become: yes | ||
file: | ||
path: "{{ item }}" | ||
state: directory | ||
mode: 0755 | ||
owner: "{{ mailhog_user }}" | ||
group: "{{ mailhog_group }}" | ||
with_items: | ||
- "{{ mailhog_home_dir }}" | ||
- "{{ mailhog_home_dir }}/bin" | ||
tags: mailhog | ||
|
||
- name: Mailhog | Download Mailhog | ||
become: yes | ||
get_url: | ||
url: "{{ mailhog_binary_url }}" | ||
dest: "{{ mailhog_home_dir }}/bin/mailhog" | ||
mode: 0755 | ||
owner: "{{ mailhog_user }}" | ||
group: "{{ mailhog_group }}" | ||
tags: mailhog | ||
|
||
- name: Mailhog | Download MHSendmail | ||
become: yes | ||
get_url: | ||
url: "{{ mhsendmail_binary_url }}" | ||
dest: "{{ mailhog_home_dir }}/bin/mhsendmail" | ||
mode: 0755 | ||
owner: "{{ mailhog_user }}" | ||
group: "{{ mailhog_group }}" | ||
tags: mailhog | ||
|
||
- name: Mailhog | Symlink Mailhog to /usr/local/bin | ||
become: yes | ||
file: | ||
src: "{{ mailhog_home_dir }}/bin/mailhog" | ||
dest: /usr/local/bin/mailhog | ||
state: link | ||
tags: mailhog | ||
|
||
- name: Mailhog | Symlink Mhsendmail to /usr/local/bin | ||
become: yes | ||
file: | ||
src: "{{ mailhog_home_dir }}/bin/mhsendmail" | ||
dest: /usr/local/bin/mhsendmail | ||
state: link | ||
tags: mailhog | ||
|
||
- name: Mailhog | Configure Upstart Mailhog Service | ||
become: yes | ||
template: | ||
src: upstart/mailhog.conf.j2 | ||
dest: /etc/init/mailhog.conf | ||
mode: 0755 | ||
owner: root | ||
group: root | ||
when: ansible_distribution_version == '14.04' | ||
tags: mailhog | ||
|
||
- name: Mailhog | Configure Systemd Mailhog Service | ||
become: yes | ||
template: | ||
src: systemd/mailhog.service.j2 | ||
dest: /lib/systemd/system/mailhog.service | ||
mode: 0755 | ||
owner: root | ||
group: root | ||
when: ansible_distribution_version == '16.04' | ||
tags: mailhog | ||
|
||
- name: Mailhog | Enable Mailhog | ||
become: yes | ||
service: | ||
name: mailhog | ||
enabled: yes | ||
state: started | ||
tags: mailhog |
11 changes: 11 additions & 0 deletions
11
provisioning/roles/mailhog/templates/systemd/mailhog.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description= | ||
Documentation= | ||
User={{ mailhog_user }} | ||
Group={{ mailhog_group }} | ||
|
||
[Service] | ||
ExecStart={{ mailhog_home_dir }}/bin/mailhog | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
11 changes: 11 additions & 0 deletions
11
provisioning/roles/mailhog/templates/upstart/mailhog.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
description "Mailhog" | ||
|
||
start on runlevel [2345] | ||
stop on runlevel [!2345] | ||
|
||
respawn | ||
|
||
setuid {{ mailhog_user }} | ||
setgid {{ mailhog_group }} | ||
|
||
exec {{ mailhog_home_dir }}/bin/mailhog |