Files
env-ansible/tasks/workstation/linux/software/tlp.yml
T

66 lines
2.1 KiB
YAML

---
# 20260716 - Hyperling
# Attempt to save battery life by having a daemon tune the CPU and disable
# unneeded components like USB, Bluetooth, WiFi, etc when not in use.
## Conflicts ##
- name: Workstation | Linux | Software | TLP | Conflicts | Disable
service:
name: power-profiles-daemon
state: stopped
enabled: false
- name: Workstation | Linux | Software | TLP | Conflicts | Remove
package:
name: power-profiles-daemon
state: absent
## Install TLP + Associated Software ##
- name: Workstation | Linux | Software | TLP | Install
package:
name: tlp tlp-rdw smartmontools
update_cache: yes
## Configuration ##
# Device choices:
# - bluetooth
# - nfc
# - wifi
# - wwan
# Bluetooth and WiFi are not always used so disable on boot.
# NFC and WWAN (cellular) are never used so always disable.
- name: Workstation | Linux | Software | TLP | Config
lineinfile:
path: "{{ tlp_config }}"
regexp: '{{ item.key }}'
line: '{{ item.value }} # MANAGED BY ANSIBLE'
state: present
create: yes
backup: yes
loop:
- { "key": '^[\#]?DEVICES_TO_DISABLE_ON_STARTUP', "value": 'DEVICES_TO_DISABLE_ON_STARTUP="bluetooth nfc wifi wwan"'}
# Ensure these stay commented, once the device is booted the user is in control. #
- { "key": '^[\#]?DEVICES_TO_ENABLE_ON_STARTUP', "value": '#DEVICES_TO_ENABLE_ON_STARTUP=""'}
- { "key": '^[\#]?DEVICES_TO_ENABLE_ON_AC', "value": '#DEVICES_TO_ENABLE_ON_AC=""'}
- { "key": '^[\#]?DEVICES_TO_DISABLE_ON_BAT', "value": '#DEVICES_TO_DISABLE_ON_BAT=""'}
# Help preserve battery life by not fully charging. #
- { "key": '^[\#]?START_CHARGE_THRESH_BAT0', "value": 'START_CHARGE_THRESH_BAT0=75'}
- { "key": '^[\#]?STOP_CHARGE_THRESH_BAT0', "value": 'STOP_CHARGE_THRESH_BAT0=80'}
- { "key": '^[\#]?START_CHARGE_THRESH_BAT1', "value": 'START_CHARGE_THRESH_BAT1=75'}
- { "key": '^[\#]?STOP_CHARGE_THRESH_BAT1', "value": 'STOP_CHARGE_THRESH_BAT1=80'}
## Enable + Start ##
# Ensure the service is running and will run after reboot.
- name: Workstation | Linux | Software | TLP | Enable + Start
service:
name: tlp
state: started
enabled: true