From 92cbac9568cfa47efe15c7773949e6a537a5149c Mon Sep 17 00:00:00 2001 From: VC Date: Mon, 4 Nov 2024 13:24:14 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F:=20replace=20cpupower=20with?= =?UTF-8?q?=20customized=20tuned?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playbooks/nas.yml | 2 +- roles/cpupower/tasks/main.yml | 12 ------------ roles/tuned/files/active_profile | 1 + roles/tuned/files/profile_mode | 1 + roles/tuned/handlers/main.yml | 6 ++++++ roles/tuned/tasks/main.yml | 27 +++++++++++++++++++++++++++ 6 files changed, 36 insertions(+), 13 deletions(-) delete mode 100644 roles/cpupower/tasks/main.yml create mode 100644 roles/tuned/files/active_profile create mode 100644 roles/tuned/files/profile_mode create mode 100644 roles/tuned/handlers/main.yml create mode 100644 roles/tuned/tasks/main.yml diff --git a/playbooks/nas.yml b/playbooks/nas.yml index 033f8a3..d53c93c 100644 --- a/playbooks/nas.yml +++ b/playbooks/nas.yml @@ -7,4 +7,4 @@ - zfs - nfs - smart - - cpupower + - tuned diff --git a/roles/cpupower/tasks/main.yml b/roles/cpupower/tasks/main.yml deleted file mode 100644 index c1f0e66..0000000 --- a/roles/cpupower/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- - -- name: Install cpupower - ansible.builtin.apt: - name: linux-cpupower - update_cache: true - state: present - -- name: Set cpupower to min - ansible.builtin.command: cpupower frequency-set -r -g powersave - register: cpupower_output - changed_when: cpupower_output.rc != 0 diff --git a/roles/tuned/files/active_profile b/roles/tuned/files/active_profile new file mode 100644 index 0000000..e12c9dc --- /dev/null +++ b/roles/tuned/files/active_profile @@ -0,0 +1 @@ +powersave spindown-disk diff --git a/roles/tuned/files/profile_mode b/roles/tuned/files/profile_mode new file mode 100644 index 0000000..2905494 --- /dev/null +++ b/roles/tuned/files/profile_mode @@ -0,0 +1 @@ +manual diff --git a/roles/tuned/handlers/main.yml b/roles/tuned/handlers/main.yml new file mode 100644 index 0000000..7cfe067 --- /dev/null +++ b/roles/tuned/handlers/main.yml @@ -0,0 +1,6 @@ +--- + +- name: Restart tuned + ansible.builtin.service: + name: tuned + state: restarted diff --git a/roles/tuned/tasks/main.yml b/roles/tuned/tasks/main.yml new file mode 100644 index 0000000..69acc39 --- /dev/null +++ b/roles/tuned/tasks/main.yml @@ -0,0 +1,27 @@ +--- + +- name: Install tuned + ansible.builtin.apt: + name: "{{ item }}" + state: present + update_cache: true + loop: + - tuned + - tuned-utils + +- name: Put config files + ansible.builtin.copy: + src: "files/{{ item }}" + dest: "/etc/tuned/{{ item }}" + owner: root + group: root + mode: "0o644" + loop: + - active_profile + - profile_mode + notify: Restart tuned + +- name: Ensure tuned is started + ansible.builtin.service: + name: tuned + state: started