agaric-coop/box/provisioning/roles/geerlingguy.mailhog/tasks/main.yml

43 lines
1.1 KiB
YAML

---
# 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