123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- - name: 'Install Postfix packages'
- apt:
- pkg:
- - 'postfix'
- - 'ca-certificates'
- - 'procmail'
- - 'libsasl2-modules'
- install_recommends: 'no'
- state: 'present'
- when: with_postfix|bool
- tags:
- - 'smtp'
- - name: 'Install mail aliases file'
- template:
- src: 'aliases.j2'
- dest: '/etc/aliases'
- owner: 'root'
- group: 'root'
- mode: '0644'
- notify:
- - 'Regenerate aliases cache'
- when: with_mail_aliases|bool
- tags:
- - 'smtp'
- - name: 'Install Postfix main configuration'
- template:
- src: 'postfix/main.cf.j2'
- dest: '/etc/postfix/main.cf'
- owner: 'root'
- group: 'root'
- mode: '0644'
- notify:
- - 'Reload Postfix'
- when: with_postfix|bool
- tags:
- - 'smtp'
- - name: 'Update Postfix master config for slowsmtp transport'
- blockinfile:
- dest: '/etc/postfix/master.cf'
- marker: '# ======= {mark} slowsmtp transport (managed by ansible) ======'
- content: |
- slowsmtp unix - - n - 5 smtp
- -o smtp_destination_concurrency_limit=3
- -o slowsmtp_destination_rate_delay=1
- notify:
- - 'Reload Postfix'
- when: with_postfix_slowsmtp|bool
- tags:
- - 'smtp'
- - name: 'Install Postfix slowsmtp transport map'
- template:
- src: 'postfix/transport_slowsmtp.j2'
- dest: '/etc/postfix/transport_slowsmtp'
- owner: 'root'
- group: 'root'
- mode: '0644'
- notify:
- - 'Rehash slowsmtp transport map'
- - 'Reload Postfix'
- when: with_postfix_slowsmtp|bool
- tags:
- - 'smtp'
- - name: 'Install Postfix SASL sender relay map'
- template:
- src: 'postfix/sasl_sender_relay.j2'
- dest: '/etc/postfix/sasl/sender_relay'
- owner: 'root'
- group: 'root'
- mode: '0600'
- notify:
- - 'Rehash SASL sender relay map'
- - 'Reload Postfix'
- when: with_postfix_external_smtp|bool
- tags:
- - 'smtp'
- - name: 'Install Postfix SASL credentials map'
- template:
- src: 'postfix/sasl_credentials.j2'
- dest: '/etc/postfix/sasl/credentials'
- owner: 'root'
- group: 'root'
- mode: '0600'
- notify:
- - 'Rehash SASL credentials map'
- - 'Reload Postfix'
- when: with_postfix_external_smtp|bool
- tags:
- - 'smtp'
- - name: 'Install Postfix SASL sender rewrite map'
- template:
- src: 'postfix/sasl_sender_rewrite.j2'
- dest: '/etc/postfix/sasl/sender_rewrite'
- owner: 'root'
- group: 'root'
- mode: '0600'
- notify:
- - 'Reload Postfix'
- when: with_postfix_external_smtp|bool and postfix_external_sender_rewrites
- tags:
- - 'smtp'
- # vim: ft=yaml.ansible
|