summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-05-27 01:18:00 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-05-27 01:18:00 +0200
commit322b5d2228a863b30010dc857589692634bbc0a4 (patch)
treeae438ab1eade4d170accd18a56b499b26175e890
parentdisable sk-2019 und sk-cloudia for now (diff)
add simple postfix role
-rw-r--r--roles/postfix/simple/defaults/main.yml18
-rw-r--r--roles/postfix/simple/handlers/main.yml5
-rw-r--r--roles/postfix/simple/tasks/main.yml22
3 files changed, 45 insertions, 0 deletions
diff --git a/roles/postfix/simple/defaults/main.yml b/roles/postfix/simple/defaults/main.yml
new file mode 100644
index 00000000..009f1239
--- /dev/null
+++ b/roles/postfix/simple/defaults/main.yml
@@ -0,0 +1,18 @@
+---
+postfix_simple_mydestination:
+ - "$myhostname"
+ - "{{ host_name }}.{{ host_domain }}"
+ - "localhost"
+
+postfix_simple_mynetworks:
+ - "127.0.0.0/8"
+ - "[::ffff:127.0.0.0]/104"
+ - "[::1]/128"
+
+postfix_simple_inet_interfaces:
+ - "all"
+
+postfix_simple_inet_protocols:
+ - "all"
+
+postfix_simple_relayhost: ""
diff --git a/roles/postfix/simple/handlers/main.yml b/roles/postfix/simple/handlers/main.yml
new file mode 100644
index 00000000..bea754c9
--- /dev/null
+++ b/roles/postfix/simple/handlers/main.yml
@@ -0,0 +1,5 @@
+---
+- name: restart postfix
+ service:
+ name: postfix
+ state: restarted
diff --git a/roles/postfix/simple/tasks/main.yml b/roles/postfix/simple/tasks/main.yml
new file mode 100644
index 00000000..4309c3ac
--- /dev/null
+++ b/roles/postfix/simple/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+- name: install postfix package
+ apt:
+ name: postfix
+ state: present
+
+- name: basic postfix options
+ vars:
+ postfix_options:
+ mydestination: "{{ postfix_simple_mydestination | join(', ') }}"
+ mynetworks: "{{ postfix_simple_mynetworks | join(', ') }}"
+ relayhost: "{{ postfix_simple_relayhost }}"
+ inet_interfaces: "{{ postfix_simple_inet_interfaces | join(', ') }}"
+ inet_protocols: "{{ postfix_simple_inet_protocols | join(', ') }}"
+ loop: "{{ postfix_options | dict2items }}"
+ loop_control:
+ label: "{{ item.key }} = {{ item.value }}"
+ lineinfile:
+ regexp: "^#?\\s*{{ item.key }}\\s*="
+ line: "{{ item.key }} = {{ item.value }}"
+ dest: /etc/postfix/main.cf
+ notify: restart postfix