diff --git a/ansible/environments/laptop/host_vars/odolinux b/ansible/environments/laptop/host_vars/odolinux index 13a7128..ed6cf1c 100644 --- a/ansible/environments/laptop/host_vars/odolinux +++ b/ansible/environments/laptop/host_vars/odolinux @@ -23,3 +23,9 @@ graphics_driver: "intel" build_user: name: talexander group: talexander +wireguard_directory: odo +enabled_wireguard: + - wgh +cputype: "intel" +hwpstate: true +cores: 8 diff --git a/ansible/roles/cpu/files/disable_turboboost_tmpfiles.conf b/ansible/roles/cpu/files/disable_turboboost_tmpfiles.conf new file mode 100644 index 0000000..e70a469 --- /dev/null +++ b/ansible/roles/cpu/files/disable_turboboost_tmpfiles.conf @@ -0,0 +1,2 @@ +# Disable turboboost. This makes the laptop significantly quieter and probably helps battery life. +w- /sys/devices/system/cpu/intel_pstate/no_turbo - - - - 1 diff --git a/ansible/roles/cpu/tasks/linux.yaml b/ansible/roles/cpu/tasks/linux.yaml index e1835f0..69f3268 100644 --- a/ansible/roles/cpu/tasks/linux.yaml +++ b/ansible/roles/cpu/tasks/linux.yaml @@ -1,6 +1,2 @@ -# - name: Install packages -# pacman: -# name: -# - foo -# state: present -# update_cache: true +- include_tasks: "tasks/linux_{{cputype}}.yaml" + when: cputype is defined diff --git a/ansible/roles/cpu/tasks/linux_intel.yaml b/ansible/roles/cpu/tasks/linux_intel.yaml new file mode 100644 index 0000000..41c49eb --- /dev/null +++ b/ansible/roles/cpu/tasks/linux_intel.yaml @@ -0,0 +1,27 @@ +- name: Install packages + package: + name: + - powertop + state: present + +- name: Install tmpfiles.d configuration + copy: + src: "files/{{ item }}_tmpfiles.conf" + dest: "/etc/tmpfiles.d/{{ item }}.conf" + mode: 0644 + owner: root + group: wheel + loop: + - disable_turboboost + +- name: Favor energy efficiency for Speed Shift + when: hwpstate is defined and hwpstate and cores is defined + template: + src: "templates/{{ item.src }}.j2" + dest: "{{ item.dest }}" + mode: 0755 + owner: root + group: wheel + loop: + - src: energy_performance_preference.conf + dest: /etc/tmpfiles.d/energy_performance_preference.conf diff --git a/ansible/roles/cpu/templates/energy_performance_preference.conf.j2 b/ansible/roles/cpu/templates/energy_performance_preference.conf.j2 new file mode 100644 index 0000000..b5a4239 --- /dev/null +++ b/ansible/roles/cpu/templates/energy_performance_preference.conf.j2 @@ -0,0 +1,4 @@ +# Favor energy efficiency for Speed Shift +{% for core in range(0, cores, 1) %} +w- /sys/devices/system/cpu/cpufreq/policy{{core}}/energy_performance_preference - - - - power +{% endfor %}