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.

106 lines
2.8 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: service.yaml
  14. vars:
  15. service_name: postfix
  16. service_packages:
  17. - postfix
  18. - postfix-ldap
  19. # TODO: log, add a centralized log server
  20. - rsyslog
  21. - name: configure ldap-aliases for postfix
  22. template:
  23. src: ldap-aliases.cf.j2
  24. dest: "/etc/postfix/ldap-aliases.cf"
  25. notify: restart postfix
  26. - name: provide postfix aliases from ldap-aliases
  27. lineinfile:
  28. dest: /etc/postfix/main.cf
  29. line: "virtual_alias_maps = proxy:ldap:/etc/postfix/ldap-aliases.cf"
  30. notify: restart postfix
  31. - name: configure ldap-domains for postfix
  32. template:
  33. src: ldap-domains.cf.j2
  34. dest: "/etc/postfix/ldap-domains.cf"
  35. notify: restart postfix
  36. - name: provide postfix mailbox domains from ldap-domains
  37. lineinfile:
  38. dest: /etc/postfix/main.cf
  39. line: "virtual_mailbox_domains = proxy:ldap:/etc/postfix/ldap-domains.cf"
  40. notify: restart postfix
  41. - name: configure ldap-accounts for postfix
  42. template:
  43. src: ldap-accounts.cf.j2
  44. dest: "/etc/postfix/ldap-accounts.cf"
  45. notify: restart postfix
  46. - name: provide postfix users from ldap-accounts
  47. lineinfile:
  48. dest: /etc/postfix/main.cf
  49. line: "virtual_mailbox_maps = proxy:ldap:/etc/postfix/ldap-accounts.cf"
  50. notify: restart postfix
  51. - lineinfile:
  52. dest: /etc/postfix/main.cf
  53. line: "mydestination = mail.lilik.it, localhost"
  54. regexp: 'mydestination ='
  55. state: present
  56. notify: restart postfix
  57. - name: edit postfix mynetworks
  58. lineinfile:
  59. dest: /etc/postfix/main.cf
  60. line: "mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/16"
  61. regexp: 'mynetworks ='
  62. state: present
  63. notify: restart postfix
  64. - name: create transport map
  65. lineinfile:
  66. dest: /etc/postfix/transport
  67. line: "lists.lilik.it :[{{ lists_server }}]"
  68. regexp: "lists.lilik.it"
  69. create: yes
  70. register: postfix_transport_result
  71. notify: restart postfix
  72. - name: ensure transport map is compiled
  73. shell: postmap /etc/postfix/transport
  74. notify: reload postfix
  75. when: postfix_transport_result | changed
  76. - name: enable transport map
  77. lineinfile:
  78. dest: /etc/postfix/main.cf
  79. line: "transport_maps = hash:/etc/postfix/transport"
  80. regexp: 'transport_maps ='
  81. state: present
  82. notify: restart postfix
  83. - name: add lists.lilik.it relay
  84. lineinfile:
  85. dest: /etc/postfix/main.cf
  86. line: "relay_domains = lists.lilik.it"
  87. regexp: 'relay_domains ='
  88. state: present
  89. notify: restart postfix
  90. - name: install antivirus and anti spam services
  91. include: antispam.yaml