aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nullmailer
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-03-25 11:49:45 -0700
committerbnewbold <bnewbold@robocracy.org>2016-03-25 11:49:45 -0700
commitbe8701c13800eb84fc4afb118c16738abee55850 (patch)
tree7060e1b8ca09c1c9fd2957ba258a9ad624035d1d /roles/nullmailer
downloadinfra-be8701c13800eb84fc4afb118c16738abee55850.tar.gz
infra-be8701c13800eb84fc4afb118c16738abee55850.zip
import basics from NSA's commission repo
Diffstat (limited to 'roles/nullmailer')
-rw-r--r--roles/nullmailer/defaults/main.yml5
-rw-r--r--roles/nullmailer/handlers/main.yml5
-rw-r--r--roles/nullmailer/tasks/main.yml33
-rw-r--r--roles/nullmailer/templates/etc_nullmailer_adminaddr.j21
-rw-r--r--roles/nullmailer/templates/etc_nullmailer_defaultdomain.j21
-rw-r--r--roles/nullmailer/templates/etc_nullmailer_remotes.j22
-rw-r--r--roles/nullmailer/templates/mailname.j21
7 files changed, 48 insertions, 0 deletions
diff --git a/roles/nullmailer/defaults/main.yml b/roles/nullmailer/defaults/main.yml
new file mode 100644
index 0000000..8ce958d
--- /dev/null
+++ b/roles/nullmailer/defaults/main.yml
@@ -0,0 +1,5 @@
+
+# REQUIRED nullmailer_smtp_host
+# REQUIRED nullmailer_smtp_user
+# REQUIRED nullmailer_smtp_pass
+email_domain: "{{ ansible_domain }}"
diff --git a/roles/nullmailer/handlers/main.yml b/roles/nullmailer/handlers/main.yml
new file mode 100644
index 0000000..d25367d
--- /dev/null
+++ b/roles/nullmailer/handlers/main.yml
@@ -0,0 +1,5 @@
+---
+- name: reload nullmailer
+ service:
+ name: nullmailer
+ state: reloaded \ No newline at end of file
diff --git a/roles/nullmailer/tasks/main.yml b/roles/nullmailer/tasks/main.yml
new file mode 100644
index 0000000..d694173
--- /dev/null
+++ b/roles/nullmailer/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: Install nullmailer and mailx
+ apt: name={{ item }} state=installed
+ with_items:
+ - nullmailer
+ - heirloom-mailx
+ tags:
+ - dependencies
+
+- name: Enable and run nullmailer service
+ service:
+ name: nullmailer
+ enabled: yes
+ state: restarted
+
+- name: Configure nullmailer - adminaddr
+ template: src=etc_nullmailer_adminaddr.j2 dest=/etc/nullmailer/adminaddr
+ when: admin_email is defined
+
+- name: Configure nullmailer - defaultdomain
+ template: src=etc_nullmailer_defaultdomain.j2 dest=/etc/nullmailer/defaultdomain
+ when: email_domain is defined
+
+- name: Configure nullmailer - remotes
+ template: src=etc_nullmailer_remotes.j2 dest=/etc/nullmailer/remotes
+ when: nullmailer_smtp_pass is defined
+ notify: reload nullmailer
+
+- name: Create mailname
+ template: src=mailname.j2 dest=/etc/mailname mode=0644
+ when: email_domain is defined
+ notify: reload nullmailer
+
diff --git a/roles/nullmailer/templates/etc_nullmailer_adminaddr.j2 b/roles/nullmailer/templates/etc_nullmailer_adminaddr.j2
new file mode 100644
index 0000000..aac956b
--- /dev/null
+++ b/roles/nullmailer/templates/etc_nullmailer_adminaddr.j2
@@ -0,0 +1 @@
+{{ admin_email }}
diff --git a/roles/nullmailer/templates/etc_nullmailer_defaultdomain.j2 b/roles/nullmailer/templates/etc_nullmailer_defaultdomain.j2
new file mode 100644
index 0000000..f1e1018
--- /dev/null
+++ b/roles/nullmailer/templates/etc_nullmailer_defaultdomain.j2
@@ -0,0 +1 @@
+{{ email_domain }}
diff --git a/roles/nullmailer/templates/etc_nullmailer_remotes.j2 b/roles/nullmailer/templates/etc_nullmailer_remotes.j2
new file mode 100644
index 0000000..0e4f1ae
--- /dev/null
+++ b/roles/nullmailer/templates/etc_nullmailer_remotes.j2
@@ -0,0 +1,2 @@
+# {{ ansible_managed }}
+{{ nullmailer_smtp_host }} smtp --port=465 --ssl --user={{ nullmailer_smtp_user }} --pass={{ nullmailer_smtp_pass }}
diff --git a/roles/nullmailer/templates/mailname.j2 b/roles/nullmailer/templates/mailname.j2
new file mode 100644
index 0000000..b305ac1
--- /dev/null
+++ b/roles/nullmailer/templates/mailname.j2
@@ -0,0 +1 @@
+{{ ansible_fqdn }} \ No newline at end of file