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.

8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. {% for cpu_core in range(salt['grains.get']('num_cpus', 1)) %}
  28. governor_write_sysfs_cpu_core_{{ cpu_core }}:
  29. module.run:
  30. - name: sysfs.write
  31. - key: devices/system/cpu/cpu{{ cpu_core }}/cpufreq/scaling_governor
  32. - value: {{ system.cpu.governor }}
  33. {%- endfor %}
  34. {%- endif %}
  35. {%- endif %}