aboutsummaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/_workstation/basetools/vars/os_archlinux.yml1
-rw-r--r--roles/_workstation/pacman/defaults/main.yml3
-rw-r--r--roles/_workstation/pacman/tasks/main.yml20
-rw-r--r--roles/_workstation/pacman/templates/paccache.hook.j211
-rw-r--r--roles/_workstation/sleep/tasks/main.yml12
-rw-r--r--roles/_workstation/sleep/templates/user-sleep@.service.j217
6 files changed, 64 insertions, 0 deletions
diff --git a/roles/_workstation/basetools/vars/os_archlinux.yml b/roles/_workstation/basetools/vars/os_archlinux.yml
index 130bacc..3e99d36 100644
--- a/roles/_workstation/basetools/vars/os_archlinux.yml
+++ b/roles/_workstation/basetools/vars/os_archlinux.yml
@@ -39,6 +39,7 @@ basetools_distribution_packages:
- pamixer
- pavucontrol
- pciutils
+ - pacman-contrib
- pdfjs
- postgresql
- pyenv
diff --git a/roles/_workstation/pacman/defaults/main.yml b/roles/_workstation/pacman/defaults/main.yml
new file mode 100644
index 0000000..8571f33
--- /dev/null
+++ b/roles/_workstation/pacman/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+
+pacman_hooks_dir: /etc/pacman.d/hooks
diff --git a/roles/_workstation/pacman/tasks/main.yml b/roles/_workstation/pacman/tasks/main.yml
new file mode 100644
index 0000000..7086eae
--- /dev/null
+++ b/roles/_workstation/pacman/tasks/main.yml
@@ -0,0 +1,20 @@
+---
+
+- name: install pacman-contrib
+ ansible.builtin.package:
+ name: pacman-contrib
+ state: present
+
+- name: create hooks directory
+ ansible.builtin.file:
+ path: "{{ pacman_hooks_dir }}"
+ state: directory
+ mode: "0755"
+
+- name: generate paccache hook
+ ansible.builtin.template:
+ src: paccache.hook.j2
+ dest: "{{ pacman_hooks_dir }}/paccache.hook"
+ owner: 0
+ group: 0
+ mode: "0644"
diff --git a/roles/_workstation/pacman/templates/paccache.hook.j2 b/roles/_workstation/pacman/templates/paccache.hook.j2
new file mode 100644
index 0000000..77b8f4e
--- /dev/null
+++ b/roles/_workstation/pacman/templates/paccache.hook.j2
@@ -0,0 +1,11 @@
+[Trigger]
+Operation = Upgrade
+Operation = Install
+Operation = Remove
+Type = Package
+Target = *
+
+[Action]
+Description = Cleaning pacman cache
+When = PostTransaction
+Exec = /usr/bin/paccache -rvk2
diff --git a/roles/_workstation/sleep/tasks/main.yml b/roles/_workstation/sleep/tasks/main.yml
new file mode 100644
index 0000000..1842adf
--- /dev/null
+++ b/roles/_workstation/sleep/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+
+- name: generate user-sleep system service
+ ansible.builtin.template:
+ src: user-sleep@.service.j2
+ dest: /etc/systemd/system/user-sleep@.service
+ mode: "0755"
+
+- name: enable user-sleep system service
+ ansible.builtin.service:
+ name: user-sleep@1000
+ enabled: true
diff --git a/roles/_workstation/sleep/templates/user-sleep@.service.j2 b/roles/_workstation/sleep/templates/user-sleep@.service.j2
new file mode 100644
index 0000000..34d404d
--- /dev/null
+++ b/roles/_workstation/sleep/templates/user-sleep@.service.j2
@@ -0,0 +1,17 @@
+# managed by Ansible
+
+[Unit]
+Description=sleep.target of a systemd user session
+Before=suspend.target sleep.target hibernate.target
+StopWhenUnneeded=yes
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/systemctl --user start suspend.target
+ExecStop=/usr/bin/systemctl --user stop suspend.target
+User=%I
+Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/bus
+RemainAfterExit=yes
+
+[Install]
+WantedBy=suspend.target sleep.target hibernate.target
remember that computers suck.