- name: install packages package: name: - postfix state: latest - name: deploy postfix main.cf template: src: main.cf.j2 dest: /etc/postfix/main.cf owner: root group: root mode: '0644' - name: deploy postfix master.cf template: src: master.cf.j2 dest: /etc/postfix/master.cf owner: root group: root mode: '0644' - name: create mailadmin user user: name: mailadmin shell: /usr/sbin/nologin password_lock: yes - name: deploy aliases file template: src: aliases dest: /etc/aliases owner: root group: root mode: '0644' - name: deploy login_maps template: src: login_maps dest: /etc/postfix/login_maps owner: root group: root mode: '0644' - name: deploy local_maps template: src: local_maps dest: /etc/postfix/local_maps owner: root group: root mode: '0644' - name: update address databases shell: | newaliases postmap /etc/postfix/login_maps postmap /etc/postfix/local_maps - name: deploy header checks file copy: src: header_checks dest: /etc/postfix/header_checks owner: root group: root mode: '0644' - name: deploy body checks file copy: src: body_checks dest: /etc/postfix/body_checks owner: root group: root mode: '0644' - name: enable postfix systemd: enabled: yes masked: no name: postfix - name: restart postfix service: name: postfix state: restarted