Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- if system.kernel is defined %}
  4. {%- set kernel_boot_opts = [] %}
  5. {%- do kernel_boot_opts.append('isolcpus=' ~ system.kernel.isolcpu) if system.kernel.isolcpu is defined %}
  6. {%- do kernel_boot_opts.append('elevator=' ~ system.kernel.elevator) if system.kernel.elevator is defined %}
  7. {%- do kernel_boot_opts.extend(system.kernel.boot_options) if system.kernel.boot_options is defined %}
  8. {%- if kernel_boot_opts %}
  9. include:
  10. - linux.system.grub
  11. /etc/default/grub.d/99-custom-settings.cfg:
  12. file.managed:
  13. - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT {{ kernel_boot_opts|join(' ') }}"'
  14. - require:
  15. - file: grub_d_directory
  16. {%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
  17. - watch_in:
  18. - cmd: grub_update
  19. {%- endif %}
  20. {%- endif %}
  21. {%- if system.kernel.version is defined %}
  22. linux_kernel_package:
  23. pkg.installed:
  24. - pkgs:
  25. - linux-image-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  26. {%- if system.kernel.get('headers', False) %}
  27. - linux-headers-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  28. {%- endif %}
  29. {%- if system.kernel.get('extra', False) %}
  30. - linux-image-extra-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
  31. {%- endif %}
  32. - refresh: true
  33. # Not very Salt-ish.. :-(
  34. linux_kernel_old_absent:
  35. cmd.wait:
  36. - name: "dpkg -l '*linux-generic-*[0-9]*' '*linux-image-*[0-9]*' '*linux-headers-*[0-9]*' '*linux-image-extra-*[0-9]*' | grep -E '^ii' | awk '{print $2}' | grep -v '{{ system.kernel.version }}' | xargs dpkg --purge --force-depends"
  37. - watch:
  38. - pkg: linux_kernel_package
  39. {%- endif %}
  40. {%- for module in system.kernel.get('modules', []) %}
  41. linux_kernel_module_{{ module }}:
  42. kmod.present:
  43. - name: {{ module }}
  44. - persist: true
  45. {%- endfor %}
  46. {%- if system.kernel.module is defined %}
  47. modprobe_d_directory:
  48. file.directory:
  49. - name: /etc/modprobe.d
  50. - user: root
  51. - group: root
  52. - mode: 755
  53. {%- for module_name in system.kernel.module %}
  54. /etc/modprobe.d/{{ module_name }}.conf:
  55. file.managed:
  56. - user: root
  57. - group: root
  58. - mode: 0644
  59. - template: jinja
  60. - source: salt://linux/files/modprobe.conf.jinja
  61. - defaults:
  62. module_name: {{ module_name }}
  63. - require:
  64. - file: modprobe_d_directory
  65. {%- endfor %}
  66. {%- endif %}
  67. {%- for sysctl_name, sysctl_value in system.kernel.get('sysctl', {}).items() %}
  68. linux_kernel_{{ sysctl_name }}:
  69. sysctl.present:
  70. - name: {{ sysctl_name }}
  71. - value: {{ sysctl_value }}
  72. {%- endfor %}
  73. {%- endif %}
  74. {%- endif %}