Saltstack Official Linux Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

51 行
1.1KB

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.cpu.governor is defined %}
  3. linux_sysfs_package:
  4. pkg.installed:
  5. - pkgs:
  6. - sysfsutils
  7. - refresh: true
  8. /etc/sysfs.d:
  9. file.directory:
  10. - require:
  11. - pkg: linux_sysfs_package
  12. ondemand_service_disable:
  13. service.dead:
  14. - name: ondemand
  15. - enable: false
  16. {%- if grains.get('virtual', None) in ['physical', None] %}
  17. {#- Governor cannot be set in VMs, etc. #}
  18. /etc/sysfs.d/governor.conf:
  19. file.managed:
  20. - source: salt://linux/files/governor.conf.jinja
  21. - template: jinja
  22. - user: root
  23. - group: root
  24. - mode: 0644
  25. - defaults:
  26. governor: {{ system.cpu.governor }}
  27. - require:
  28. - file: /etc/sysfs.d
  29. {% for cpu_core in range(salt['grains.get']('num_cpus', 1)) %}
  30. {% set core_key = 'devices/system/cpu/cpu' + cpu_core|string + '/cpufreq/scaling_governor' %}
  31. {% if salt['file.file_exists']('/sys/'+ core_key) %}
  32. governor_write_sysfs_cpu_core_{{ cpu_core }}:
  33. module.run:
  34. - name: sysfs.write
  35. - key: {{ core_key }}
  36. - value: {{ system.cpu.governor }}
  37. {% endif %}
  38. {%- endfor %}
  39. {%- endif %}
  40. {%- endif %}