dkim.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. - name: 'Install opendkim main configuration'
  10. template:
  11. src: 'opendkim/opendkim.conf.j2'
  12. dest: '/etc/opendkim.conf'
  13. owner: 'root'
  14. group: 'opendkim'
  15. mode: '0640'
  16. notify:
  17. - 'Restart opendkim'
  18. - name: 'Create opendkim config directory'
  19. file:
  20. path: '/etc/opendkim'
  21. state: 'directory'
  22. owner: 'root'
  23. group: 'opendkim'
  24. mode: '0750'
  25. - name: 'Install opendkim KeyTable'
  26. template:
  27. src: 'opendkim/KeyTable.j2'
  28. dest: '/etc/opendkim/KeyTable'
  29. owner: 'root'
  30. group: 'opendkim'
  31. mode: '0640'
  32. notify:
  33. - 'Restart opendkim'
  34. - name: 'Install opendkim SigningTable'
  35. template:
  36. src: 'opendkim/SigningTable.j2'
  37. dest: '/etc/opendkim/SigningTable'
  38. owner: 'root'
  39. group: 'opendkim'
  40. mode: '0640'
  41. notify:
  42. - 'Restart opendkim'
  43. - name: 'Install opendkim InternalHosts'
  44. template:
  45. src: 'opendkim/InternalHosts.j2'
  46. dest: '/etc/opendkim/InternalHosts'
  47. owner: 'root'
  48. group: 'opendkim'
  49. mode: '0640'
  50. notify:
  51. - 'Restart opendkim'
  52. - name: 'Install DKIM private keys'
  53. copy:
  54. content: "{{lookup('file', 'data/dkim/' + item + '.pem')}}"
  55. dest: '/etc/opendkim/{{ item }}_default.pem'
  56. owner: 'root'
  57. group: 'opendkim'
  58. mode: '0640'
  59. with_items: '{{ dkim_domains }}'
  60. when: dkim_domains