diff --git a/handlers/main.yml b/handlers/main.yml index d9d57795c8abc9ce195e4f453e5464ad6fc19501..5ca759a0502b31642a2b9d1b1d917c2e145f250f 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,14 @@ --- +- name: make postfix aliases.db + environment: + LC_MESSAGES: 'C' + command: make aliases.db + args: + chdir: /etc/postfix + register: result + notify: ['reload postfix'] + changed_when: "result.stdout != \"make: 'aliases.db' is up to date.\"" + - name: make postfix transport.db environment: LC_MESSAGES: 'C' @@ -9,6 +19,16 @@ notify: ['reload postfix'] changed_when: "result.stdout != \"make: 'transport.db' is up to date.\"" +- name: make postfix virtual.db + environment: + LC_MESSAGES: 'C' + command: make virtual.db + args: + chdir: /etc/postfix + register: result + notify: ['reload postfix'] + changed_when: "result.stdout != \"make: 'virtual.db' is up to date.\"" + - name: make postfix environment: LC_MESSAGES: 'C' diff --git a/tasks/main.yml b/tasks/main.yml index d9441e4279c4c90b2fb436438383b4b8914bd500..a106ad5199469864996e1eba9faf81b5a2909b5d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,6 +27,15 @@ mode: 0644 notify: ['make postfix'] +- name: Generate Postfix aliases map + template: + src: templates/aliases.in.js + dest: /etc/postfix/aliases.in + owner: root + group: root + mode: 0644 + notify: ['make postfix aliases.db'] + - name: Generate Postfix transport map template: src: templates/transport.in.js @@ -35,5 +44,15 @@ group: root mode: 0644 notify: ['make postfix transport.db'] + +- name: Generate Postfix virtual aliases map + template: + src: templates/virtual.in.js + dest: /etc/postfix/virtual.in + owner: root + group: root + mode: 0644 + notify: ['make postfix virtual.db'] + ... # vi: set ts=2 sts=2 sw=2 et ft=yaml: diff --git a/templates/Makefile.j2 b/templates/Makefile.j2 index deee71e2ce84707bd87e7592d5b072bbd19d1edd..fe5f3a621d7d490d2e216bf380c06dea13209892 100644 --- a/templates/Makefile.j2 +++ b/templates/Makefile.j2 @@ -2,7 +2,9 @@ # Manage Postfix DB files idempotently -MAPS = transport.db +MAPS = aliases.db \ + transport.db \ + virtual.db all: $(MAPS) diff --git a/templates/aliases.in.js b/templates/aliases.in.js new file mode 100644 index 0000000000000000000000000000000000000000..ab0d77f8a01eee0704fff8c75f09247d62663145 --- /dev/null +++ b/templates/aliases.in.js @@ -0,0 +1,2 @@ +# {{ ansible_managed }} + diff --git a/templates/virtual.in.js b/templates/virtual.in.js new file mode 100644 index 0000000000000000000000000000000000000000..ab0d77f8a01eee0704fff8c75f09247d62663145 --- /dev/null +++ b/templates/virtual.in.js @@ -0,0 +1,2 @@ +# {{ ansible_managed }} +