dkim.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. - name: 'Install opendkim packages'
  2. apt:
  3. pkg: '{{ item }}'
  4. install_recommends: 'no'
  5. state: 'installed'
  6. update_cache: 'yes'
  7. with_items:
  8. - 'opendkim'
  9. when: with_opendkim
  10. - name: 'Install opendkim main configuration'
  11. template:
  12. src: 'opendkim/opendkim.conf.j2'
  13. dest: '/etc/opendkim.conf'
  14. owner: 'root'
  15. group: 'opendkim'
  16. mode: '0640'
  17. notify:
  18. - 'Restart opendkim'
  19. when: with_opendkim
  20. - name: 'Create opendkim config directory'
  21. file:
  22. path: '/etc/opendkim'
  23. state: 'directory'
  24. owner: 'root'
  25. group: 'opendkim'
  26. mode: '0750'
  27. when: with_opendkim
  28. - name: 'Install opendkim KeyTable'
  29. template:
  30. src: 'opendkim/KeyTable.j2'
  31. dest: '/etc/opendkim/KeyTable'
  32. owner: 'root'
  33. group: 'opendkim'
  34. mode: '0640'
  35. notify:
  36. - 'Restart opendkim'
  37. when: with_opendkim
  38. - name: 'Install opendkim SigningTable'
  39. template:
  40. src: 'opendkim/SigningTable.j2'
  41. dest: '/etc/opendkim/SigningTable'
  42. owner: 'root'
  43. group: 'opendkim'
  44. mode: '0640'
  45. notify:
  46. - 'Restart opendkim'
  47. when: with_opendkim
  48. - name: 'Install DKIM private keys'
  49. copy:
  50. content: "{{lookup('file', 'data/dkim/' + item + '.pem')}}"
  51. dest: '/etc/opendkim/{{ item }}_default.pem'
  52. owner: 'root'
  53. group: 'opendkim'
  54. mode: '0640'
  55. with_items: dkim_domains
  56. when: dkim_domains