# A mail client needs to send mail. I prefer to send via a local MTA, # which routes things out via a smarthost. - name: install postfix and related packages apt: name: - postfix - libsasl2-modules - mailutils - name: configure postfix template: src: main.cf dest: /etc/postfix/main.cf notify: restart postfix - name: set mailname copy: content: "{{ mailname }}\n" dest: /etc/mailname owner: root group: root mode: 0644 # Set up the smarthost relay credentials. - name: set smarthost relay credentials template: src: sasl_passwd dest: /etc/postfix/sasl_passwd mode: 0600 - name: postmap relay credentials shell: | postmap /etc/postfix/sasl_passwd - name: install aliases copy: src: aliases dest: /etc/aliases owner: root group: root mode: 0644 - name: run newaliases shell: newaliases