From b7bccaf7ff75fd2234b9232f595cbc8e226b80e9 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 26 Nov 2018 22:33:54 +0100 Subject: o Importing bitraf-base, packages and postfix-satellite from Bitraf. o Configuring nextcloud. --- ansible/roles/postfix-satellite/handlers/main.yml | 8 +++ ansible/roles/postfix-satellite/tasks/main.yml | 4 ++ .../postfix-satellite/tasks/postfix-satellite.yml | 70 ++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 ansible/roles/postfix-satellite/handlers/main.yml create mode 100644 ansible/roles/postfix-satellite/tasks/main.yml create mode 100644 ansible/roles/postfix-satellite/tasks/postfix-satellite.yml (limited to 'ansible/roles/postfix-satellite') diff --git a/ansible/roles/postfix-satellite/handlers/main.yml b/ansible/roles/postfix-satellite/handlers/main.yml new file mode 100644 index 0000000..b6cdb87 --- /dev/null +++ b/ansible/roles/postfix-satellite/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: reload postfix + service: name=postfix state=reloaded + become: yes + +- name: postmap /etc/postfix/sasl_passwd + become: yes + shell: postmap /etc/postfix/sasl_passwd diff --git a/ansible/roles/postfix-satellite/tasks/main.yml b/ansible/roles/postfix-satellite/tasks/main.yml new file mode 100644 index 0000000..3aeb3cc --- /dev/null +++ b/ansible/roles/postfix-satellite/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- tags: postfix-satellite + become: true + include: postfix-satellite.yml diff --git a/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml b/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml new file mode 100644 index 0000000..46f2fea --- /dev/null +++ b/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml @@ -0,0 +1,70 @@ +- name: Update apt cache + apt: + update_cache: yes + cache_valid_time: 3600 +- name: Install package + package: + name: "{{ item }}" + state: present + with_items: + - postfix + - libsasl2-modules + - swaks + +- name: "Configure postfix: main.cf" + tags: postfix-satellite-config + notify: reload postfix + lineinfile: + dest: /etc/postfix/main.cf + line: "{{ item.key }} = {{ item.value }}" + regexp: "^{{ item.key }} =" + with_items: + - key: "mydomain" + value: "bitraf.no" + - key: "myorigin" + value: "bitraf.no" + - key: "mydestination" + value: "" + - key: "smtp_sasl_auth_enable" + value: "yes" + - key: "smtp_sasl_password_maps" + value: "hash:/etc/postfix/sasl_passwd" + - key: "smtp_sasl_security_options" + value: "noanonymous" + - key: "smtp_sasl_tls_security_options" + value: "noanonymous" + - key: "smtp_tls_security_level" + value: "encrypt" + - key: "header_size_limit" + value: "4096000" + - key: "relayhost" + value: "{{ postfix__relayhost }}" + +- name: Create /etc/postfix/sasl_passwd + tags: postfix-satellite-config + copy: + dest: /etc/postfix/sasl_passwd + content: "" + force: no + mode: 0600 + +- name: "Configure postfix: sasl_passwd" + tags: postfix-satellite-config + no_log: yes + lineinfile: + dest: /etc/postfix/sasl_passwd + line: "{{ item.host }} {{ item.username }}:{{ item.password }}" + regexp: "^{{ item.host|regex_escape() }}" + with_items: "{{ postfix.sasl_password }}" + notify: postmap /etc/postfix/sasl_passwd + +- name: Enable postfix service + service: + name: postfix + state: started + enabled: yes + +- name: Remove old /etc/postfix/sasl directory + file: + state: absent + path: "/etc/postfix/sasl" -- cgit v1.2.3