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:
Kevin Veen-Birkenbach 2023-05-27 11:59:37 +02:00
parent bd557c739b
commit 3341fc56ac
6 changed files with 39 additions and 5 deletions

View File

@ -1,5 +0,0 @@
- name: Install caffeine
kewlfft.aur.aur:
use: yay
name:
- caffeine-ng

View File

@ -0,0 +1,2 @@
# Defaults for caffeine_auto_start role
caffeine_executable_path: "/usr/bin/caffeine"

View 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

View 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

View File

@ -0,0 +1,8 @@
[Unit]
Description=Caffeine auto start
[Service]
ExecStart={{ caffeine_executable_path }}
[Install]
WantedBy=multi-user.target