Skip to content

Instantly share code, notes, and snippets.

@mizhka
Last active February 14, 2024 16:23
Show Gist options
  • Save mizhka/ba21fcba43974de61930275803e438eb to your computer and use it in GitHub Desktop.
Save mizhka/ba21fcba43974de61930275803e438eb to your computer and use it in GitHub Desktop.
Ansible playbook for MaxPerformance
- name: tune operating system
hosts: all
become: true
vars:
sysctl_settings:
- { key: 'vm.swappiness', value: '3'}
- { key: 'kernel.sched_autogroup_enabled', value: '0'}
- { key: 'kernel.sched_migration_cost_n', value: '50000000'}
pkgs:
- cpufrequtils
- linux-cpupower
tasks:
- name: set sysctl parameters
ansible.posix.sysctl:
name: "{{ item.key }}"
value: "{{ item.value }}"
state: present
loop: "{{ sysctl_settings }}"
- name: install packages
ansible.builtin.package:
name: "{{ pkgs }}"
state: latest
- name: set governor to performance
ansible.builtin.copy:
content: 'GOVERNOR="performance"'
dest: /etc/default/cpufrequtils
- name: patch grub
hosts: all
become: true
roles:
- role: robertdebock.grub
grub_options:
- option: intel_pstate
value: enable
- option: processor.max_cstate
value: 1
- option: intel_idle.max_cstate
value: 1
- option: cgroup.memory
value: nokmem
- option: hugepagesz
value: 1G
- option: default_hugepagesz
value: 1G
- option: transparent_hugepages
value: never
@capricornusx
Copy link

опечтка в 38-й строке - option: intel_idle.max_cstateы

@mizhka
Copy link
Author

mizhka commented Feb 14, 2024

опечтка в 38-й строке - option: intel_idle.max_cstateы

Спасибо, поправил!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment