mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-29 16:01:04 +01:00
Implemented autostart of caffeine with the help of chat gpt: https://chat.openai.com/share/fa846dac-6068-4386-b3e7-b75f1248ec82
This commit is contained in:
parent
738938ae96
commit
431e38fec4
@ -1,5 +0,0 @@
|
||||
- name: Install caffeine
|
||||
kewlfft.aur.aur:
|
||||
use: yay
|
||||
name:
|
||||
- caffeine-ng
|
2
roles/pc_application_caffeine/defaults/main.yml
Normal file
2
roles/pc_application_caffeine/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
# Defaults for caffeine_auto_start role
|
||||
caffeine_executable_path: "/usr/bin/caffeine"
|
10
roles/pc_application_caffeine/handlers/main.yml
Normal file
10
roles/pc_application_caffeine/handlers/main.yml
Normal file
@ -0,0 +1,10 @@
|
||||
# handlers file for caffeine_auto_start
|
||||
- name: reload systemd
|
||||
command: systemctl daemon-reload
|
||||
|
||||
- name: enable and start caffeine
|
||||
systemd:
|
||||
name: caffeine.service
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
19
roles/pc_application_caffeine/tasks/main.yml
Normal file
19
roles/pc_application_caffeine/tasks/main.yml
Normal file
@ -0,0 +1,19 @@
|
||||
- name: install caffeine
|
||||
kewlfft.aur.aur:
|
||||
use: yay
|
||||
name:
|
||||
- caffeine-ng
|
||||
|
||||
- name: Check if caffeine is installed
|
||||
command: command -v caffeine
|
||||
register: caffeine_installed
|
||||
changed_when: False
|
||||
failed_when: caffeine_installed.rc != 0
|
||||
|
||||
- name: Copy caffeine systemd service file
|
||||
template:
|
||||
src: caffeine.service.j2
|
||||
dest: /etc/systemd/system/caffeine.service
|
||||
notify:
|
||||
- reload systemd
|
||||
- enable and start caffeine
|
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Caffeine auto start
|
||||
|
||||
[Service]
|
||||
ExecStart={{ caffeine_executable_path }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user