--- - name: install packages apt: pkg: - postfix - name: master configuration template: src: master.cf.j2 dest: /etc/postfix/master.cf notify: restart postfix - name: main configuration template: src: main.cf.j2 dest: /etc/postfix/main.cf notify: reload postfix - name: mailname copy: content: "{{mailname}}" dest: /etc/mailname notify: reload postfix - import_tasks: spf.yaml when: postfix_check_spf - import_tasks: opendkim.yaml when: postfix_with_opendkim - import_tasks: opendmarc.yaml when: postfix_with_opendmarc - import_tasks: postfixadmin.yml when: postfix_method == "postfixadmin" - name: check postfix configuration command: postfix check changed_when: false - name: configuration pull directory local_action: file args: path: ~/host_files/{{inventory_hostname}}/etc state: directory - name: pull configuration synchronize: src: /etc/postfix dest: ~/host_files/{{inventory_hostname}}/etc/ mode: pull recursive: true