--- # Much of the postfix setup process was based on github.com/Oefenweb/ansible-postfix # # Copyright (c) Oefenweb.nl # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is furnished # to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. - name: Configure debconf debconf: name: "{{ item.name }}" question: "{{ item.question }}" value: "{{ item.value }}" vtype: "{{ item.vtype }}" with_items: "{{ postfix_debconf_selections }}" - name: Install and configure Postfix ansible.builtin.package: name: "{{ postfix_install }}" - name: Copy header checks ansible.builtin.copy: src: header_checks dest: /etc/postfix/ owner: root group: root mode: '0644' notify: restart postfix - name: Configure Postfix master process ansible.builtin.copy: src: master.cf dest: /etc/postfix/ owner: root group: root mode: '0644' notify: restart postfix - name: Configure Postfix main process ansible.builtin.template: src: main.cf.j2 dest: /etc/postfix/main.cf - name: Configure virtual mailboxes ansible.builtin.template: src: vmailbox.j2 dest: /etc/postfix/vmailbox notify: new virtual mailboxes - name: Configure virtual domains ansible.builtin.template: src: virtual_domains.j2 dest: /etc/postfix/virtual_domains notify: new virtual domains - name: Flush handlers ansible.builtin.meta: flush_handlers - name: Generate Diffie-Hellman parameters with the size recommended by postconf (2048 bits) community.crypto.openssl_dhparam: path: "{{ postfix_smtpd_tls_dh1024_param_file }}" size: 2048 - name: Ensure postfix service is started ansible.builtin.service: name: postfix state: started enabled: yes - name: Set up helper script to create new email aliases ansible.builtin.template: src: create-email-alias.j2 dest: /usr/local/bin/create-email-alias mode: '0755'