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.

132 lines
3.5 KiB

  1. - name: configure Postfix (domain)
  2. debconf:
  3. name: 'postfix'
  4. question: 'postfix/domainpostfix/main_mailer_type'
  5. vtype: 'string'
  6. value: 'Internet Site'
  7. - name: configure Postfix (organization)
  8. debconf:
  9. name: 'postfix'
  10. question: 'postfix/mailname'
  11. vtype: 'string'
  12. value: 'lilik.it'
  13. - include_role:
  14. name: service
  15. vars:
  16. service_name: postfix
  17. service_packages:
  18. - postfix
  19. - postfix-ldap
  20. # TODO: log, add a centralized log server
  21. - rsyslog
  22. - name: configure ldap-aliases for postfix
  23. template:
  24. src: ldap-aliases.cf.j2
  25. dest: "/etc/postfix/ldap-aliases.cf"
  26. notify: restart postfix
  27. - name: provide postfix aliases from ldap-aliases
  28. lineinfile:
  29. dest: /etc/postfix/main.cf
  30. line: "virtual_alias_maps = proxy:ldap:/etc/postfix/ldap-aliases.cf"
  31. notify: restart postfix
  32. - name: configure ldap-domains for postfix
  33. template:
  34. src: ldap-domains.cf.j2
  35. dest: "/etc/postfix/ldap-domains.cf"
  36. notify: restart postfix
  37. - name: provide postfix mailbox domains from ldap-domains
  38. lineinfile:
  39. dest: /etc/postfix/main.cf
  40. line: "virtual_mailbox_domains = proxy:ldap:/etc/postfix/ldap-domains.cf"
  41. notify: restart postfix
  42. - name: configure ldap-accounts for postfix
  43. template:
  44. src: ldap-accounts.cf.j2
  45. dest: "/etc/postfix/ldap-accounts.cf"
  46. notify: restart postfix
  47. - name: provide postfix users from ldap-accounts
  48. lineinfile:
  49. dest: /etc/postfix/main.cf
  50. line: "virtual_mailbox_maps = proxy:ldap:/etc/postfix/ldap-accounts.cf"
  51. notify: restart postfix
  52. - lineinfile:
  53. dest: /etc/postfix/main.cf
  54. line: "mydestination = mail.lilik.it, localhost"
  55. regexp: 'mydestination ='
  56. state: present
  57. notify: restart postfix
  58. - name: edit postfix mynetworks
  59. lineinfile:
  60. dest: /etc/postfix/main.cf
  61. line: "mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/16"
  62. regexp: 'mynetworks ='
  63. state: present
  64. notify: restart postfix
  65. - name: enable tls for outgoing mail
  66. lineinfile:
  67. dest: /etc/postfix/main.cf
  68. line: "smtp_tls_security_level = encrypt"
  69. regexp: 'smtp_tls_security_level ='
  70. state: present
  71. notify: restart postfix
  72. - name: create transport map
  73. lineinfile:
  74. dest: /etc/postfix/transport
  75. line: "lists.lilik.it :[{{ lists_server }}]"
  76. regexp: "lists.lilik.it"
  77. create: yes
  78. register: postfix_transport_result
  79. notify: restart postfix
  80. - name: ensure transport map is compiled
  81. shell: postmap /etc/postfix/transport
  82. notify: reload postfix
  83. when: postfix_transport_result | changed
  84. - name: enable transport map
  85. lineinfile:
  86. dest: /etc/postfix/main.cf
  87. line: "transport_maps = hash:/etc/postfix/transport"
  88. regexp: 'transport_maps ='
  89. state: present
  90. notify: restart postfix
  91. - name: add lists.lilik.it relay
  92. lineinfile:
  93. dest: /etc/postfix/main.cf
  94. line: "relay_domains = lists.lilik.it"
  95. regexp: 'relay_domains ='
  96. state: present
  97. notify: restart postfix
  98. - name: install antivirus and anti spam services
  99. include: antispam.yaml
  100. - name: install opendkim service
  101. include: dkim.yaml
  102. - name: add milters for smtp to postfix
  103. lineinfile:
  104. dest: '/etc/postfix/main.cf'
  105. line: 'smtpd_milters={{ postfix_milters|join(",") }}'
  106. regexp: '^smtpd_milters='
  107. notify: restart postfix
  108. - name: add milters for non smtp to postfix
  109. lineinfile:
  110. dest: '/etc/postfix/main.cf'
  111. line: 'non_smtpd_milters={{ postfix_milters|join(",") }}'
  112. regexp: '^non_smtpd_milters='
  113. notify: restart postfix