init.sls 965 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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: salt://sysctl/sysctl.conf
  14. - watch_in:
  15. - cmd: reload-sysctl
  16. /etc/sysctl.d/global.conf:
  17. file.managed:
  18. - source: salt://sysctl/global.conf
  19. - watch_in:
  20. - cmd: reload-sysctl
  21. {% if 'router' in roles %}
  22. /etc/sysctl.d/router.conf:
  23. file.managed:
  24. - source: salt://sysctl/router.conf
  25. - watch_in:
  26. - cmd: reload-sysctl
  27. {% else %}
  28. /etc/sysctl.d/router.conf:
  29. file.absent
  30. {% endif %}
  31. {# Remove old files #}
  32. {% for file in ['20-arp_caches.conf', '21-ip_forward.conf', '22-kernel.conf', 'NAT.conf', 'nf-ignore-bridge.conf'] %}
  33. /etc/sysctl.d/{{ file }}:
  34. file.absent
  35. {% endfor %}