-
Notifications
You must be signed in to change notification settings - Fork 1
/
power.yml
40 lines (35 loc) · 1.08 KB
/
power.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
- name: Power settings
hosts: laptops
become: true
tasks:
- name: Disable lid switch and suspend key
lineinfile: dest=/etc/systemd/logind.conf
regexp={{item.setting}}
line='{{item.setting}}={{item.value}}'
with_items:
- { setting: HandleSuspendKey, value: ignore }
- { setting: HandleLidSwitch, value: lock }
- { setting: HandlePowerKey, value: ignore }
notify: restart logind
- name: Install utilities
pacman: name={{item}}
with_items:
- acpid
- pm-utils
- powertop
- name: Start ACPID
service: name=acpid enabled=yes state=started
- name: Enable ACPID custom handlers
file: dest=/etc/acpi/events/anything mode=0750
- name: Use Power Button to toggle keyboard
copy:
content: |
event=button/power
action={{homedir}}/bin/acpi-power-button
dest: /etc/acpi/events/power-button
owner: bhaskell
group: root
mode: 0750
handlers:
- name: restart logind
service: name=systemd-logind state=restarted