From 322b5d2228a863b30010dc857589692634bbc0a4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 27 May 2020 01:18:00 +0200 Subject: add simple postfix role --- roles/postfix/simple/defaults/main.yml | 18 ++++++++++++++++++ roles/postfix/simple/handlers/main.yml | 5 +++++ roles/postfix/simple/tasks/main.yml | 22 ++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 roles/postfix/simple/defaults/main.yml create mode 100644 roles/postfix/simple/handlers/main.yml create mode 100644 roles/postfix/simple/tasks/main.yml (limited to 'roles') 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 -- cgit v1.2.3