From 8070c0cf9aa181f98d52407f053b941f08c16613 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 1 Aug 2019 13:32:01 +0200 Subject: postfix-satellite: o Removing keys default_transport and relay_transport. o Moving postfix-satellite to its own file. --- ansible/all.yml | 21 +-------------------- ansible/plays/postfix-satellite.yml | 19 +++++++++++++++++++ .../postfix-satellite/tasks/postfix-satellite.yml | 14 ++++++++++++-- 3 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 ansible/plays/postfix-satellite.yml (limited to 'ansible') diff --git a/ansible/all.yml b/ansible/all.yml index 02b78ae..05502bf 100644 --- a/ansible/all.yml +++ b/ansible/all.yml @@ -20,26 +20,6 @@ tags: dovecot - bind -- hosts: - - all !knot - roles: - - postfix-satellite - vars: - username: "{{ ansible_hostname }}.trygvis.io" - postfix: - sasl_password: - - host: "[trygvis.io]:587" - username: "{{ username }}" - password: "{{ dovecot__passwords[username] }}" - - tasks: - - tags: postfix-satellite - become: yes - lineinfile: - dest: /etc/postfix/sasl_passwd - state: absent - regex: "^\\[knot.trygvis.io\\]" - - hosts: - linode-dns-update roles: @@ -52,6 +32,7 @@ tags: systemd-networkd become: yes +- import_playbook: plays/postfix-satellite.yml - import_playbook: nftables.yml - import_playbook: lxc-host.yml - import_playbook: wireguard.yml diff --git a/ansible/plays/postfix-satellite.yml b/ansible/plays/postfix-satellite.yml new file mode 100644 index 0000000..af77d17 --- /dev/null +++ b/ansible/plays/postfix-satellite.yml @@ -0,0 +1,19 @@ +- hosts: + - all !knot + roles: + - postfix-satellite + vars: + username: "{{ ansible_hostname }}.trygvis.io" + postfix: + sasl_password: + - host: "[trygvis.io]:587" + username: "{{ username }}" + password: "{{ dovecot__passwords[username] }}" + + tasks: + - tags: postfix-satellite + become: yes + lineinfile: + dest: /etc/postfix/sasl_passwd + state: absent + regex: "^\\[knot.trygvis.io\\]" diff --git a/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml b/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml index 8a11a84..2303523 100644 --- a/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml +++ b/ansible/roles/postfix-satellite/tasks/postfix-satellite.yml @@ -2,6 +2,7 @@ package: name: "{{ items }}" state: present + tags: packages vars: items: - postfix @@ -13,15 +14,20 @@ notify: reload postfix lineinfile: dest: /etc/postfix/main.cf - line: "{{ item.key }} = {{ item.value }}" + line: "{{ (item.key + ' = ' + item.value) if state=='present' else None }}" regexp: "^{{ item.key }} =" + state: "{{ state }}" + vars: + state: "{{ item.state|default('present') }}" with_items: - key: "mydomain" value: "{{ postfix_satellite__mydomain }}" - key: "myorigin" value: "{{ postfix_satellite__myorigin }}" - key: "mydestination" - value: "" + state: absent + - key: "myhostname" + state: absent - key: "mynetworks" value: "{{ postfix_satellite__mynetworks }}" - key: "smtp_sasl_auth_enable" @@ -38,6 +44,10 @@ value: "4096000" - key: "relayhost" value: "{{ postfix__relayhost }}" + - key: "default_transport" + state: absent + - key: "relay_transport" + state: absent - name: Create /etc/postfix/sasl_passwd tags: postfix-satellite-config -- cgit v1.2.3