--- - name: listen to all interfaces lineinfile: path: /etc/postfix/main.cf state: absent regexp: "^#?inet_interfaces = .*" notify: restart postfix - name: add relayed domains lineinfile: path: /etc/postfix/main.cf regexp: "^#?relay_domains = .*" line: "relay_domains = $mydestination, {{ relay_domains|join(',') }}" notify: restart postfix