19 lines
568 B
YAML
19 lines
568 B
YAML
|
- name: Check if laptop has option to limit battery
|
||
|
stat:
|
||
|
path: /sys/class/power_supply/BAT0/charge_control_end_threshold
|
||
|
register: battery_limiter_available
|
||
|
|
||
|
- when: battery_limiter_available.stat.exists
|
||
|
block:
|
||
|
- name: Copy service to limit battery charge
|
||
|
become: yes
|
||
|
copy:
|
||
|
src: lib/systemd/system/battery-charge-threshold.service
|
||
|
dest: /lib/systemd/system/battery-charge-threshold.service
|
||
|
|
||
|
- name: Enable battery limit service
|
||
|
become: yes
|
||
|
systemd:
|
||
|
name: battery-charge-threshold
|
||
|
enabled: yes
|