From f098b6248cd2b425d57e21899a97d77d64cb45bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Sun, 20 Oct 2024 19:58:34 +0200 Subject: feat(roles/_workstation): add TLP configuration generation --- roles/_workstation/tlp/defaults/main.yaml | 6 ++++++ roles/_workstation/tlp/tasks/main.yml | 10 ++++++++-- roles/_workstation/tlp/templates/10-ansible.conf.j2 | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 roles/_workstation/tlp/defaults/main.yaml create mode 100644 roles/_workstation/tlp/templates/10-ansible.conf.j2 diff --git a/roles/_workstation/tlp/defaults/main.yaml b/roles/_workstation/tlp/defaults/main.yaml new file mode 100644 index 0000000..15beb7c --- /dev/null +++ b/roles/_workstation/tlp/defaults/main.yaml @@ -0,0 +1,6 @@ +--- + +tlp__start_charge_threshold: 75 +tlp__stop_charge_threshold: 90 + +tlp__configuration_dir: /etc/tlp.d diff --git a/roles/_workstation/tlp/tasks/main.yml b/roles/_workstation/tlp/tasks/main.yml index 60b2fc0..db313ff 100644 --- a/roles/_workstation/tlp/tasks/main.yml +++ b/roles/_workstation/tlp/tasks/main.yml @@ -5,8 +5,14 @@ name: tlp state: present -- name: enable and start tlp +- name: generate tlp template + ansible.builtin.template: + src: 10-ansible.conf.j2 + dest: "{{ tlp__configuration_dir }}/10-ansible.conf" + mode: "0644" + +- name: enable and restart tlp ansible.builtin.service: name: tlp - state: started + state: restarted enabled: true diff --git a/roles/_workstation/tlp/templates/10-ansible.conf.j2 b/roles/_workstation/tlp/templates/10-ansible.conf.j2 new file mode 100644 index 0000000..377bef0 --- /dev/null +++ b/roles/_workstation/tlp/templates/10-ansible.conf.j2 @@ -0,0 +1,4 @@ +# managed by Ansible + +START_CHARGE_THRESH_BAT0={{ tlp__start_charge_threshold }} +STOP_CHARGE_THRESH_BAT0={{ tlp__stop_charge_threshold }} -- cgit v1.2.3