From 822dfdb40889a9f1dcc09771c2503fac176da37b Mon Sep 17 00:00:00 2001 From: phil Date: Fri, 24 Mar 2023 13:19:22 +0100 Subject: [PATCH] Create single virtual domain task for use in other playbooks --- tasks/main.yml | 4 ++++ tasks/postfix.yml | 2 -- tasks/virtual_domains.yml | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tasks/virtual_domains.yml diff --git a/tasks/main.yml b/tasks/main.yml index 4674001..eabedfb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,6 +7,10 @@ ansible.builtin.import_tasks: postfix.yml tags: postfix +- name: Virtual domains + ansible.builtin.import_tasks: virtual_domains.yml + tags: virtual_domains + - name: OnionMX ansible.builtin.import_tasks: onionmx.yml tags: onionmx diff --git a/tasks/postfix.yml b/tasks/postfix.yml index 8702b17..f981469 100644 --- a/tasks/postfix.yml +++ b/tasks/postfix.yml @@ -47,7 +47,6 @@ - sender_checks - transport_global_exceptions - transport_relay - - virtual_domains notify: reload postfix - name: "Postfix | Run postmap" @@ -64,7 +63,6 @@ - file: relay_checks - file: sender_checks - file: transport_relay - - file: virtual_domains - name: "Postfix | Create dhparam file" community.crypto.openssl_dhparam: diff --git a/tasks/virtual_domains.yml b/tasks/virtual_domains.yml new file mode 100644 index 0000000..4e2a8bb --- /dev/null +++ b/tasks/virtual_domains.yml @@ -0,0 +1,14 @@ +--- +- name: "Virtual domain | Copy lookup tables from templates" + ansible.builtin.template: + src: "postfix/conf.d/virtual_domains.j2" + dest: "{{ postfix_conf_dir }}/virtual_domains" + mode: "0644" + notify: reload postfix + +- name: "Postfix | Run postmap" + ansible.builtin.command: "postmap cdb:virtual_domains" + args: + chdir: "{{ postfix_conf_dir }}" + changed_when: false + notify: reload postfix