Saltstack Official Linux Formula
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.

41 lines
1.2KB

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- if system.kernel is defined %}
  4. {%- if system.kernel.version is defined %}
  5. linux_kernel_package:
  6. pkg.installed:
  7. - names:
  8. - linux-image-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  9. {%- if system.kernel.get('headers', False) %}
  10. - linux-headers-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  11. {%- endif %}
  12. {%- if system.kernel.get('extra', False) %}
  13. - linux-image-extra-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  14. {%- endif %}
  15. - refresh: true
  16. # Not very Salt-ish.. :-(
  17. linux_kernel_old_absent:
  18. cmd.wait:
  19. - name: "apt-get purge -y $(dpkg -l '*linux-image-[0-9]*' '*linux-headers-[0-9]*' '*linux-image-extra-[0-9]*' | grep -E '^ii' | awk '{print $2}' | grep -v '{{ system.kernel.version }}')"
  20. - watch:
  21. - pkg: linux_kernel_package
  22. {%- endif %}
  23. {%- for sysctl_name, sysctl_value in system.kernel.get('sysctl', {}).iteritems() %}
  24. linux_kernel_{{ sysctl_name }}:
  25. sysctl.present:
  26. - name: {{ sysctl_name }}
  27. - value: {{ sysctl_value }}
  28. {%- endfor %}
  29. {%- endif %}
  30. {%- endif %}