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.

105 lines
3.2 KiB

  1. - name: configure exim4-config
  2. debconf:
  3. name: 'exim4-config'
  4. question: '{{ item.key }}'
  5. vtype: 'string'
  6. value: '{{ item.value }}'
  7. with_dict:
  8. exim4/dc_smarthost: '{{ stmp_relay }}'
  9. exim4/dc_minimaldns: false
  10. exim4/dc_postmaster:
  11. exim4/dc_localdelivery: mbox format in /var/mail/
  12. exim4/dc_readhost:
  13. exim4/dc_other_hostnames: '{{ ansible_hostname }}.lilik.it'
  14. exim4/dc_relay_nets:
  15. exim4/exim4-config-title:
  16. exim4/no_config: false
  17. exim4/mailname: '{{ ansible_hostname }}.lilik.it'
  18. exim4/use_split_config: false
  19. exim4/hide_mailname: false
  20. exim4/dc_relay_domains:
  21. notify:
  22. - update exim4 configuration
  23. - restart exim4
  24. - name: configure exim4-config (sympa_transport)
  25. debconf:
  26. name: 'exim4-config'
  27. question: '{{ item.key }}'
  28. vtype: 'string'
  29. value: '{{ item.value }}'
  30. with_dict:
  31. exim4/dc_eximconfig_configtype: mail sent by smarthost; received via SMTP or fetchmail
  32. exim4/dc_local_interfaces:
  33. when: sympa_transport | bool
  34. notify:
  35. - update exim4 configuration
  36. - restart exim4
  37. - name: configure exim4-config (smarthost)
  38. debconf:
  39. name: 'exim4-config'
  40. question: '{{ item.key }}'
  41. vtype: 'string'
  42. value: '{{ item.value }}'
  43. with_dict:
  44. exim4/dc_eximconfig_configtype: mail sent by smarthost; no local mail
  45. exim4/dc_local_interfaces: 127.0.0.1 ; ::1
  46. when: not sympa_transport | bool
  47. notify:
  48. - update exim4 configuration
  49. - restart exim4
  50. - block:
  51. - include: service.yaml
  52. # static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
  53. vars:
  54. service_name: exim4
  55. service_packages:
  56. - exim4
  57. - name: exim4 macro for sympa aliases
  58. blockinfile:
  59. dest: /etc/exim4/exim4.conf.localmacros
  60. block: |
  61. #--------------
  62. # Activating pipe transport in system_aliases router (pipes in /etc/aliases)
  63. .ifndef SYSTEM_ALIASES_PIPE_TRANSPORT
  64. SYSTEM_ALIASES_PIPE_TRANSPORT = address_pipe
  65. .endif
  66. .ifndef SYSTEM_ALIASES_USER
  67. SYSTEM_ALIASES_USER = sympa
  68. .endif
  69. .ifndef SYSTEM_ALIASES_GROUP
  70. SYSTEM_ALIASES_GROUP = sympa
  71. .endif
  72. #--------------
  73. create: yes
  74. notify:
  75. - update exim4 configuration
  76. - restart exim4
  77. - name: exim4 pipe for sympa aliases
  78. blockinfile:
  79. dest: /etc/exim4/exim4.conf.template
  80. block: |
  81. #--------------
  82. # Using alias pipe definitions for the Sympa lists in /etc/mail/sympa/aliases
  83. sympa_aliases:
  84. debug_print = "R: system_aliases for $local_part@$domain"
  85. driver = redirect
  86. domains = +local_domains
  87. allow_fail
  88. allow_defer
  89. data = ${lookup{$local_part}lsearch{/etc/mail/sympa/aliases}}
  90. user = sympa
  91. group = sympa
  92. pipe_transport = address_pipe
  93. #--------------
  94. insertbefore: 'system_aliases:'
  95. notify:
  96. - update-exim4.conf
  97. - restart exim4
  98. when: sympa_transport | bool