ansible-role-postfix
ansible-role-postfix copied to clipboard
#28 postfix address rewrite
name: Pull request about: Describe the proposed change
Describe the change Adds the feature postfix address rewrite.
Testing Was deployed via ansible to own infrastructure and replaced the manual additions as expected.
cat >postfix.yml<<"EOF" && ansible-playbook -i hosts.postfix postfix.yml -l cmk03.example.com --check --diff
- name: Configure postfix
hosts: all
become: yes
gather_facts: yes
roles:
- role: ansible-role-postfix # replace with robertdebock.roles.postfix when feature is merged
postfix_relayhost: "[relay.example.com]:25"
postfix_myhostname: "{{ inventory_hostname }}"
postfix_mydomain: "{{ ansible_domain }}"
postfix_myorigin: "{{ ansible_domain }}"
postfix_mynetworks:
- 127.0.0.0/8
postfix_aliases:
- name: root
destination: [email protected]
postfix_smtp_generic:
- envelope_or_header_address: "@{{ inventory_hostname }}"
sender_address: [email protected]
- envelope_or_header_address: "@{{ ansible_domain }}"
sender_address: [email protected]
EOF
--- before: /etc/postfix/main.cf
+++ after: ~/ansible/tmp/ansible-local-401679690qn44du/tmpn458ld6a/main.cf.j2
+
+smtp_generic_maps = hash:/etc/postfix/generic
# ADDRESS EXTENSIONS (e.g., user+foo)
# @@ -722,4 +724,37 @@
# Optional lookup tables with mappings from recipient address to (message delivery transport, next-hop destination). # transport_maps = hash:/etc/postfix/transport
-smtp_generic_maps = hash:/etc/postfix/generic
Additionally the new task would have added the bevor manually added entries into smtp_generic_map file.
TASK [ansible-role-postfix : Configure smtp_generics]
********************************************************************
ok: [cmk03.example.com] => ([email protected])
ok: [cmk03.example.com] => ([email protected])