Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
2
box/provisioning/roles/geerlingguy.mailhog/.gitignore
vendored
Normal file
2
box/provisioning/roles/geerlingguy.mailhog/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.retry
|
||||
tests/test.sh
|
29
box/provisioning/roles/geerlingguy.mailhog/.travis.yml
Normal file
29
box/provisioning/roles/geerlingguy.mailhog/.travis.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
services: docker
|
||||
|
||||
env:
|
||||
- distro: centos7
|
||||
- distro: centos6
|
||||
- distro: ubuntu1604
|
||||
- distro: ubuntu1404
|
||||
|
||||
script:
|
||||
# Configure test script so we can run extra tests after playbook is run.
|
||||
- export container_id=$(date +%s)
|
||||
- export cleanup=false
|
||||
|
||||
# Download test shim.
|
||||
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
|
||||
- chmod +x ${PWD}/tests/test.sh
|
||||
|
||||
# Run tests.
|
||||
- ${PWD}/tests/test.sh
|
||||
|
||||
# Send an email via mhsendmail.
|
||||
- 'docker exec --tty ${container_id} env TERM=xterm sh -c "cat /etc/ansible/roles/role_under_test/tests/message | /opt/mailhog/mhsendmail johndoe@example.com"'
|
||||
|
||||
# Test retrieving messages via MailHog API.
|
||||
- 'docker exec --tty ${container_id} env TERM=xterm sh -c "curl http://localhost:8025/api/v2/messages | grep id"'
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
20
box/provisioning/roles/geerlingguy.mailhog/LICENSE
Normal file
20
box/provisioning/roles/geerlingguy.mailhog/LICENSE
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Jeff Geerling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
55
box/provisioning/roles/geerlingguy.mailhog/README.md
Normal file
55
box/provisioning/roles/geerlingguy.mailhog/README.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
# Ansible Role: MailHog
|
||||
|
||||
[](https://travis-ci.org/geerlingguy/ansible-role-mailhog)
|
||||
|
||||
Installs [MailHog](https://github.com/mailhog/MailHog), a Go-based SMTP server and web UI/API for displaying captured emails, on RedHat or Debian-based linux systems.
|
||||
|
||||
Also installs [mhsendmail](https://github.com/mailhog/mhsendmail) so you can redirect system mail to MailHog's built-in SMTP server.
|
||||
|
||||
If you're using PHP and would like to route all PHP email into MailHog, you will need to update the `sendmail_path` configuration option in php.ini, like so:
|
||||
|
||||
sendmail_path = "{{ mailhog_install_dir }}/mhsendmail"
|
||||
|
||||
(Replace `{{ mailhog_install_dir }}` with the actual MailHog installation directory, which is `/opt/mailhog` by default—e.g. `/opt/mailhog/mhsendmail`).
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
mailhog_install_dir: /opt/mailhog
|
||||
|
||||
The directory into which the MailHog binary will be installed.
|
||||
|
||||
mailhog_binary_url: https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64
|
||||
|
||||
The MailHog binary that will be installed. You can find the latest version or a 32-bit version by visiting the [MailHog project releases page](https://github.com/mailhog/MailHog/releases).
|
||||
|
||||
mailhog_daemonize_bin_path: /usr/sbin/daemonize
|
||||
|
||||
The path to `daemonize`, which is used to launch MailHog via init script.
|
||||
|
||||
mhsendmail_binary_url: https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64
|
||||
|
||||
The mhsendmail binary that will be installed. You can find the latest version or a 32-bit version by visiting the [mhsendmail project releases page](https://github.com/mailhog/mhsendmail/releases).
|
||||
|
||||
## Dependencies
|
||||
|
||||
- geerlingguy.daemonize
|
||||
|
||||
## Example Playbook
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: geerlingguy.mailhog }
|
||||
|
||||
## License
|
||||
|
||||
MIT / BSD
|
||||
|
||||
## Author Information
|
||||
|
||||
This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
mailhog_install_dir: /opt/mailhog
|
||||
mailhog_binary_url: https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64
|
||||
mhsendmail_binary_url: https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64
|
||||
|
||||
# Path to daemonize, which is used to launch MailHog via init script.
|
||||
mailhog_daemonize_bin_path: /usr/sbin/daemonize
|
25
box/provisioning/roles/geerlingguy.mailhog/meta/main.yml
Normal file
25
box/provisioning/roles/geerlingguy.mailhog/meta/main.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
dependencies:
|
||||
- geerlingguy.daemonize
|
||||
|
||||
galaxy_info:
|
||||
author: geerlingguy
|
||||
description: "MailHog for Linux"
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 1.8
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- development
|
||||
- web
|
||||
- system
|
||||
- mail
|
43
box/provisioning/roles/geerlingguy.mailhog/tasks/main.yml
Normal file
43
box/provisioning/roles/geerlingguy.mailhog/tasks/main.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
# Install and configure MailHog.
|
||||
- name: Ensure mailhog install directory exists.
|
||||
file:
|
||||
path: "{{ mailhog_install_dir }}"
|
||||
owner: root
|
||||
group: root
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Download MailHog and mhsendmail binaries.
|
||||
get_url:
|
||||
url: "{{ item.url }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
with_items:
|
||||
- url: "{{ mailhog_binary_url }}"
|
||||
dest: "{{ mailhog_install_dir }}/mailhog"
|
||||
- url: "{{ mhsendmail_binary_url }}"
|
||||
dest: "{{ mailhog_install_dir }}/mhsendmail"
|
||||
|
||||
- name: Copy mailhog init script into place.
|
||||
template:
|
||||
src: mailhog.init.j2
|
||||
dest: /etc/init.d/mailhog
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: "ansible_service_mgr != 'systemd'"
|
||||
|
||||
- name: Copy mailhog systemd unit file into place (for systemd systems).
|
||||
template:
|
||||
src: mailhog.unit.j2
|
||||
dest: /etc/systemd/system/mailhog.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: "ansible_service_mgr == 'systemd'"
|
||||
|
||||
- name: Ensure mailhog is enabled and will start on boot.
|
||||
service: name=mailhog state=started enabled=yes
|
|
@ -0,0 +1,61 @@
|
|||
#! /bin/sh
|
||||
# /etc/init.d/mailhog
|
||||
#
|
||||
# MailHog init script.
|
||||
#
|
||||
# @author Jeff Geerling
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mailhog
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start MailHog at boot time.
|
||||
# Description: Enable MailHog.
|
||||
### END INIT INFO
|
||||
|
||||
PID=/var/run/mailhog.pid
|
||||
LOCK=/var/lock/mailhog.lock
|
||||
USER=nobody
|
||||
BIN={{ mailhog_install_dir }}/mailhog
|
||||
DAEMONIZE_BIN={{ mailhog_daemonize_bin_path }}
|
||||
|
||||
# Carry out specific functions when asked to by the system
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting mailhog."
|
||||
$DAEMONIZE_BIN -p $PID -l $LOCK -u $USER $BIN
|
||||
;;
|
||||
stop)
|
||||
if [ -f $PID ]; then
|
||||
echo "Stopping mailhog.";
|
||||
kill -TERM $(cat $PID);
|
||||
rm -f $PID;
|
||||
else
|
||||
echo "MailHog is not running.";
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
echo "Restarting mailhog."
|
||||
if [ -f $PID ]; then
|
||||
kill -TERM $(cat $PID);
|
||||
rm -f $PID;
|
||||
fi
|
||||
$DAEMONIZE_BIN -p $PID -l $LOCK -u $USER $BIN
|
||||
;;
|
||||
status)
|
||||
if [ -f $PID ]; then
|
||||
echo "MailHog is running.";
|
||||
else
|
||||
echo "MailHog is not running.";
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/mailhog {start|stop|status|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=MailHog Email Catcher
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart={{ mailhog_install_dir }}/mailhog
|
||||
StandardOutput=journal
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
11
box/provisioning/roles/geerlingguy.mailhog/tests/README.md
Normal file
11
box/provisioning/roles/geerlingguy.mailhog/tests/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Ansible Role tests
|
||||
|
||||
To run the test playbook(s) in this directory:
|
||||
|
||||
1. Install and start Docker.
|
||||
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
|
||||
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
|
||||
1. Make the test shim executable: `chmod +x tests/test.sh`.
|
||||
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
|
||||
|
||||
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`
|
5
box/provisioning/roles/geerlingguy.mailhog/tests/message
Normal file
5
box/provisioning/roles/geerlingguy.mailhog/tests/message
Normal file
|
@ -0,0 +1,5 @@
|
|||
From: johndoe@example.com
|
||||
To: janedoe@example.com
|
||||
Subject: Test email
|
||||
|
||||
Hello world!
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- src: geerlingguy.daemonize
|
30
box/provisioning/roles/geerlingguy.mailhog/tests/test.yml
Normal file
30
box/provisioning/roles/geerlingguy.mailhog/tests/test.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
- hosts: all
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure build dependencies are installed (RedHat).
|
||||
package: 'name="{{ item }}" state=present'
|
||||
with_items:
|
||||
- "@Development tools"
|
||||
- tar
|
||||
- unzip
|
||||
- net-tools
|
||||
- curl
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Ensure build dependencies are installed (Debian).
|
||||
apt: 'name="{{ item }}" state=installed'
|
||||
with_items:
|
||||
- build-essential
|
||||
- tar
|
||||
- unzip
|
||||
- net-tools
|
||||
- curl
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
roles:
|
||||
- geerlingguy.daemonize
|
||||
- role_under_test
|
Loading…
Add table
Add a link
Reference in a new issue