Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

  1. - include_role:
  2. name: service
  3. vars:
  4. service_name: opendkim
  5. service_packages:
  6. - opendkim
  7. - opendkim-tools
  8. - name: adding existing user postfix to group opendkim
  9. user: name=postfix
  10. groups=opendkim
  11. append=yes
  12. notify: restart postfix
  13. - name: create opendkim folder
  14. file:
  15. path: /etc/opendkim/
  16. state: directory
  17. mode: 0700
  18. owner: opendkim
  19. group: opendkim
  20. - name: 'enable opendkim socket on 127.0.0.1:12345'
  21. lineinfile:
  22. dest: /etc/default/opendkim
  23. line: 'SOCKET="inet:12345@127.0.0.1"'
  24. regexp: "^SOCKET="
  25. notify: restart opendkim
  26. - name: create opendkim key for lilik.it
  27. command: opendkim-genkey -D /etc/opendkim/ -d lilik.it -s {{ ansible_hostname }}
  28. args:
  29. creates: '/etc/opendkim/{{ ansible_hostname }}.private'
  30. - name: check /etc/opendkim/{{ ansible_hostname }}.private permissions
  31. file:
  32. path: '/etc/opendkim/{{ ansible_hostname }}.private'
  33. owner: opendkim
  34. group: opendkim
  35. mode: 0600
  36. - name: check /etc/opendkim/{{ ansible_hostname }}.txt permissions
  37. file:
  38. path: '/etc/opendkim/{{ ansible_hostname }}.txt'
  39. owner: opendkim
  40. group: opendkim
  41. mode: 0660
  42. - name: configure opendkim
  43. blockinfile:
  44. dest: '/etc/opendkim.conf'
  45. block: |
  46. Domain lilik.it
  47. KeyFile /etc/opendkim/{{ ansible_hostname }}.private
  48. Selector mail
  49. notify: restart opendkim
  50. - name: add opendkim milter
  51. set_fact:
  52. postfix_milters: '{{["inet:127.0.0.1:12345"] + postfix_milters}}'