--- /dev/null
+[Unit]
+Description=Disable Turbo Boost on Intel CPU
+
+[Service]
+ExecStart=/bin/sh -c 'for core in `cat /proc/cpuinfo | grep processor | awk \'{print $3}\'`; do sudo wrmsr -p$core 0x1a0 0x4000850089; done'
+ExecStop=/bin/sh -c 'for core in `cat /proc/cpuinfo | grep processor | awk \'{print $3}\'`; do sudo wrmsr -p$core 0x1a0 0x850089; done'
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.target
path: '/etc/default/grub'\r
state: 'present'\r
regexp: '^GRUB_CMDLINE_LINUX='\r
- line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt"'\r
+ line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1 intel_idle.max_cstate=1 hpet=disable tsc=reliable mce=off"'\r
notify: ['Update GRUB']\r
tags: set-grub\r
\r
tags: install-pip\r
\r
- name: Load vfio-pci by default\r
- raw: 'echo vfio-pci | sudo tee -a /etc/modules'\r
+ lineinfile:\r
+ path: '/etc/modules'\r
+ state: 'present'\r
+ line: 'vfio-pci'\r
tags: load-vfio-pci\r
+\r
+- name: Load msr by default\r
+ lineinfile:\r
+ path: '/etc/modules'\r
+ state: 'present'\r
+ line: 'msr'\r
+ tags: disable-turbo-boost\r
+\r
+- name: Disable Turbo-Boost by service\r
+ copy:\r
+ src: 'files/disable-turbo-boost.service'\r
+ dest: '/etc/systemd/system/disable-turbo-boost.service'\r
+ owner: 'root'\r
+ group: 'root'\r
+ mode: '0644'\r
+ when: >\r
+ inventory_hostname in groups['skylake']\r
+ tags: disable-turbo-boost\r
+\r
+- name: Disable Turbo-Boost by service on startup\r
+ service:\r
+ name: disable-turbo-boost\r
+ enabled: yes\r
+ when: >\r
+ inventory_hostname in groups['skylake']\r
+ tags: disable-turbo-boost\r