Nessuna descrizione

postfix.sls 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {% import 'globals.jinja' as globals %}
  2. include:
  3. - firewall.public.smtp
  4. - firewall.public.submission
  5. /etc/mailname:
  6. file.managed:
  7. - contents: {{ globals.public_fqdn }}
  8. postfix:
  9. debconf.set:
  10. - data:
  11. 'postfix/main_mailer_type':
  12. type: select
  13. value: Internet Site
  14. 'postfix/mailname':
  15. type: select
  16. value: {{ globals.public_fqdn }}
  17. 'postfix/destinations':
  18. type: select
  19. value: $myhostname, {{ grains['id'] }}, localhost.localdomain, localhost
  20. pkg.installed:
  21. - pkgs:
  22. - postfix
  23. - postfix-mysql
  24. - require:
  25. - file: /etc/mailname
  26. - debconf: postfix
  27. service.running:
  28. - watch:
  29. - pkg: postfix
  30. {% for file in [
  31. 'main.cf',
  32. 'master.cf',
  33. ] %}
  34. /etc/postfix/{{ file }}:
  35. file.managed:
  36. - source: salt://vmail/files/{{ grains['osfinger'] }}/postfix/{{ file }}
  37. - template: jinja
  38. - require:
  39. - pkg: postfix
  40. - watch_in:
  41. - service: postfix
  42. {% endfor %}
  43. {% for file in [
  44. 'mysql-virtual-alias-maps.cf',
  45. 'mysql-virtual-mailbox-domains.cf',
  46. 'mysql-virtual-mailbox-maps.cf',
  47. ] %}
  48. /etc/postfix/{{ file }}:
  49. file.managed:
  50. - source: salt://vmail/files/postfix/{{ file }}
  51. - template: jinja
  52. - context:
  53. db_host: {{ pillar['vmail']['db_host'] }}
  54. db_name: {{ pillar['vmail']['db_name'] }}
  55. db_user: {{ pillar['vmail']['db_user'] }}
  56. db_password: {{ pillar['vmail']['db_password'] }}
  57. - mode: 600
  58. - require:
  59. - pkg: postfix
  60. - watch_in:
  61. - service: postfix
  62. {% endfor %}