init.sls 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # sysctl
  3. #
  4. {%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
  5. # Define command to reload sysctl settings here without dependencies
  6. # and define inverse dependencies where useful (see sysctl.conf)
  7. reload-sysctl:
  8. cmd.wait:
  9. - watch: []
  10. - name: /sbin/sysctl --system
  11. /etc/sysctl.conf:
  12. file.managed:
  13. - source:
  14. - salt://sysctl/sysctl.conf.{{ grains.os }}.{{ grains.oscodename }}
  15. - salt://sysctl/sysctl.conf
  16. - watch_in:
  17. - cmd: reload-sysctl
  18. /etc/sysctl.d/global.conf:
  19. file.managed:
  20. - source: salt://sysctl/global.conf
  21. - watch_in:
  22. - cmd: reload-sysctl
  23. {% if 'router' in roles %}
  24. /etc/sysctl.d/router.conf:
  25. file.managed:
  26. - source: salt://sysctl/router.conf
  27. - watch_in:
  28. - cmd: reload-sysctl
  29. {% else %}
  30. /etc/sysctl.d/router.conf:
  31. file.absent
  32. {% endif %}
  33. {# Remove old files #}
  34. {% for file in ['20-arp_caches.conf', '21-ip_forward.conf', '22-kernel.conf', 'NAT.conf', 'nf-ignore-bridge.conf'] %}
  35. /etc/sysctl.d/{{ file }}:
  36. file.absent
  37. {% endfor %}