Configure vm.laptop_mode and vm.dirty_writeback_centisecs.

This commit is contained in:
Tom Alexander
2023-02-18 11:30:46 -05:00
parent 0340d2fd51
commit dd8c2ff937
3 changed files with 55 additions and 0 deletions

View File

@@ -2,8 +2,45 @@
package:
name:
- powertop
- tlp
state: present
# - name: Configure TLP
# lineinfile:
# path: /etc/tlp.conf
# regexp: "^{{ item.key }}="
# line: '{{ item.key }}="{{ item.value }}"'
# loop: "{{ tlp_config | dict2items }}"
# when: '" " in item.value'
# - name: Configure TLP
# lineinfile:
# path: /etc/tlp.conf
# regexp: "^{{ item.key }}="
# line: "{{ item.key }}={{ item.value }}"
# loop: "{{ tlp_config | dict2items }}"
# when: '" " not in item.value'
- name: Configure sysctls
sysctl:
name: "{{ item.name }}"
value: "{{ item.value }}"
state: present
sysctl_file: /etc/sysctl.d/dirty.conf
loop:
- name: vm.dirty_writeback_centisecs
value: 2000 # Default is 500 (5 seconds)
- name: Configure sysctls
sysctl:
name: "{{ item.name }}"
value: "{{ item.value }}"
state: present
sysctl_file: /etc/sysctl.d/laptop.conf
loop:
- name: vm.laptop_mode
value: 5
- name: Enable services
systemd:
name: tlp.service