diff options
Diffstat (limited to 'roles/mail/postfix/base')
-rw-r--r-- | roles/mail/postfix/base/defaults/main.yml | 18 | ||||
-rw-r--r-- | roles/mail/postfix/base/handlers/main.yml | 5 | ||||
-rw-r--r-- | roles/mail/postfix/base/tasks/main.yml | 22 |
3 files changed, 45 insertions, 0 deletions
diff --git a/roles/mail/postfix/base/defaults/main.yml b/roles/mail/postfix/base/defaults/main.yml new file mode 100644 index 00000000..a0c85d46 --- /dev/null +++ b/roles/mail/postfix/base/defaults/main.yml @@ -0,0 +1,18 @@ +--- +postfix_base_mydestination: + - "$myhostname" + - "{{ host_name }}.{{ host_domain }}" + - "localhost" + +postfix_base_mynetworks: + - "127.0.0.0/8" + - "[::ffff:127.0.0.0]/104" + - "[::1]/128" + +postfix_base_inet_interfaces: + - "loopback-only" + +postfix_base_inet_protocols: + - "all" + +postfix_base_relayhost: "" diff --git a/roles/mail/postfix/base/handlers/main.yml b/roles/mail/postfix/base/handlers/main.yml new file mode 100644 index 00000000..bea754c9 --- /dev/null +++ b/roles/mail/postfix/base/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart postfix + service: + name: postfix + state: restarted diff --git a/roles/mail/postfix/base/tasks/main.yml b/roles/mail/postfix/base/tasks/main.yml new file mode 100644 index 00000000..8cb55fe0 --- /dev/null +++ b/roles/mail/postfix/base/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_base_mydestination | join(', ') }}" + mynetworks: "{{ postfix_base_mynetworks | join(', ') }}" + relayhost: "{{ postfix_base_relayhost }}" + inet_interfaces: "{{ postfix_base_inet_interfaces | join(', ') }}" + inet_protocols: "{{ postfix_base_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 |