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.

46 lines
1.6KB

  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-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 --no-input $(dpkg -l '*linux-image-[0-9]*' '*linux-headers-[0-9]*' '*linux-extra-[0-9]*' | grep -E '^ii' | awk '{print $2}' | grep -v '{{ system.kernel.version }}')"
  20. - watch:
  21. - pkg: linux_kernel_package
  22. {%- else %}
  23. linux_kernel_package:
  24. pkg.latest:
  25. - names:
  26. - linux-image-{{ system.kernel.type|default('generic') }}{% if system.kernel.get('lts', False) %}-lts-{{ system.kernel.lts }}{% endif %}
  27. {%- if system.kernel.get('headers', False) %}
  28. - linux-headers-{{ system.kernel.type|default('generic') }}{% if system.kernel.get('lts', False) %}-lts-{{ system.kernel.lts }}{% endif %}
  29. {%- endif %}
  30. {%- if system.kernel.get('extra', False) %}
  31. - linux-extra-{{ system.kernel.type|default('generic') }}{% if system.kernel.get('lts', False) %}-lts-{{ system.kernel.lts }}{% endif %}
  32. {%- endif %}
  33. - refresh: true
  34. {%- endif %}
  35. {%- endif %}
  36. {%- endif %}