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.

kernel.sls 1.7KB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- if system.kernel is defined %}
  4. {%- if system.kernel.isolcpu is defined %}
  5. include:
  6. - linux.system.grub
  7. /etc/default/grub.d/90-isolcpu.cfg:
  8. file.managed:
  9. - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT isolcpus={{ system.kernel.isolcpu }}"'
  10. - require:
  11. - file: grub_d_directory
  12. - watch_in:
  13. - cmd: grub_update
  14. {%- endif %}
  15. {%- if system.kernel.version is defined %}
  16. linux_kernel_package:
  17. pkg.installed:
  18. - pkgs:
  19. - linux-image-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  20. {%- if system.kernel.get('headers', False) %}
  21. - linux-headers-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  22. {%- endif %}
  23. {%- if system.kernel.get('extra', False) %}
  24. - linux-image-extra-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  25. {%- endif %}
  26. - refresh: true
  27. # Not very Salt-ish.. :-(
  28. linux_kernel_old_absent:
  29. cmd.wait:
  30. - 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 }}')"
  31. - watch:
  32. - pkg: linux_kernel_package
  33. {%- endif %}
  34. {%- for module in system.kernel.get('modules', []) %}
  35. linux_kernel_module_{{ module }}:
  36. kmod.present:
  37. - name: {{ module }}
  38. - persist: true
  39. {%- endfor %}
  40. {%- for sysctl_name, sysctl_value in system.kernel.get('sysctl', {}).iteritems() %}
  41. linux_kernel_{{ sysctl_name }}:
  42. sysctl.present:
  43. - name: {{ sysctl_name }}
  44. - value: {{ sysctl_value }}
  45. {%- endfor %}
  46. {%- endif %}
  47. {%- endif %}