Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
install a mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
tdilauro committed Feb 25, 2017
1 parent 99ad98c commit e57e1d3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions dataverse.pb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
- VAULT.yaml
vars:
load_mdblocks: true
mail_relay: smtp.johnshopkins.edu
roles:
- role: dataverse
6 changes: 6 additions & 0 deletions roles/dataverse/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@ rserve_host: "{{ dataverse_host_address }}"
rserve_user: rserve
rserve_pass: "{{ rserve_pass_protected }}"
rserve_port: 6311

###############################################################################
# Mail configuration
###############################################################################

postfix_main_config_file: "/etc/postfix/main.cf"
39 changes: 39 additions & 0 deletions roles/dataverse/tasks/mailer-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- mode: yaml -*-
# vi: set ft=yaml :

---

###############################################################################
# install/enable mailer pre-reqs (RedHat/CentOS 7)
###############################################################################

- name: Ensure postfix is installed (RedHat/CentOS)
yum: name=postfix state=installed
when: ansible_os_family == 'RedHat'

###############################################################################
# update configuration
###############################################################################

- name: configure mail relay
lineinfile:
dest: "{{ postfix_main_config_file }}"
state: present
regexp: '^\s*relayhost ='
insertafter: '^\s*#\s*relayhost\s*='
line: "relayhost = {{ mail_relay }}"

- name: configure mailer hostname
lineinfile:
dest: "{{ postfix_main_config_file }}"
state: present
regexp: '^\s*myhostname\s*='
insertafter: '^\s*#\s*myhostname\s*='
line: "myhostname = {{ inventory_hostname }}"

###############################################################################
# enable/restart mail server to pick up configuration changes
###############################################################################

- name: start postfix and enable on system startup
service: name=postfix enabled=yes state=restarted
1 change: 1 addition & 0 deletions roles/dataverse/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

---

- include: mailer-config.yaml
- include: dv-prereqs.yaml
- include: dv-shib.yaml
- include: dv-httpd.yaml
Expand Down

0 comments on commit e57e1d3

Please sign in to comment.