dkim.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 opendkim InternalHosts'
  49. template:
  50. src: 'opendkim/InternalHosts.j2'
  51. dest: '/etc/opendkim/InternalHosts'
  52. owner: 'root'
  53. group: 'opendkim'
  54. mode: '0640'
  55. notify:
  56. - 'Restart opendkim'
  57. when: with_opendkim
  58. - name: 'Install DKIM private keys'
  59. copy:
  60. content: "{{lookup('file', 'data/dkim/' + item + '.pem')}}"
  61. dest: '/etc/opendkim/{{ item }}_default.pem'
  62. owner: 'root'
  63. group: 'opendkim'
  64. mode: '0640'
  65. with_items: dkim_domains
  66. when: dkim_domains