init.sls 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #
  2. # Postfix
  3. #
  4. # Force installation of bsd-mailx as it's not installed anymore in Debian Jessie..
  5. bsd-mailx:
  6. pkg.installed:
  7. - name: bsd-mailx
  8. postfix:
  9. pkg.installed:
  10. - name: postfix
  11. - requires:
  12. - file: /etc/mailname
  13. service.running:
  14. - enable: true
  15. - reload: true
  16. #
  17. # Don't listen on port 25, by default, a unix socket is enough.
  18. /etc/postfix/master.cf:
  19. file.managed:
  20. - source:
  21. - salt://postfix/master.cf.{{ grains['id'] }}
  22. - salt://postfix/master.cf.{{ grains.oscodename }}
  23. - salt://postfix/master.cf
  24. - watch_in:
  25. - service: postfix
  26. #
  27. # Send root mail to ops@ffho.net
  28. /etc/aliases:
  29. file.managed:
  30. - source:
  31. - salt://postfix/aliases.{{ grains['id'] }}
  32. - salt://postfix/aliases
  33. newaliases:
  34. cmd.wait:
  35. - name: /usr/bin/newaliases
  36. - watch:
  37. - file: /etc/aliases
  38. # Set mailname to node_id if not specified otherwise in node pillar.
  39. {% set mailname = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':mailname', grains['id']) %}
  40. /etc/mailname:
  41. file.managed:
  42. - contents: "{{ mailname }}"