- name: 'Install opendkim packages' apt: pkg: '{{ item }}' install_recommends: 'no' state: 'installed' with_items: - 'opendkim' - name: 'Install opendkim main configuration' template: src: 'opendkim/opendkim.conf.j2' dest: '/etc/opendkim.conf' owner: 'root' group: 'opendkim' mode: '0640' notify: - 'Restart opendkim' - name: 'Create opendkim config directory' file: path: '/etc/opendkim' state: 'directory' owner: 'root' group: 'opendkim' mode: '0750' - name: 'Install opendkim KeyTable' template: src: 'opendkim/KeyTable.j2' dest: '/etc/opendkim/KeyTable' owner: 'root' group: 'opendkim' mode: '0640' notify: - 'Restart opendkim' - name: 'Install opendkim SigningTable' template: src: 'opendkim/SigningTable.j2' dest: '/etc/opendkim/SigningTable' owner: 'root' group: 'opendkim' mode: '0640' notify: - 'Restart opendkim' - name: 'Install opendkim InternalHosts' template: src: 'opendkim/InternalHosts.j2' dest: '/etc/opendkim/InternalHosts' owner: 'root' group: 'opendkim' mode: '0640' notify: - 'Restart opendkim' - name: 'Install DKIM private keys' copy: content: "{{lookup('file', 'data/dkim/' + item + '.pem')}}" dest: '/etc/opendkim/{{ item }}_default.pem' owner: 'root' group: 'opendkim' mode: '0640' with_items: '{{ dkim_domains }}' when: dkim_domains