feat(user/tmpfiles): create role for user's tmpdir

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-06-03 21:53:44 +02:00
parent a87a455844
commit 7c20e9c509
Signed by: mfocko
GPG key ID: 7C47D46246790496
5 changed files with 20 additions and 0 deletions

View file

@ -46,6 +46,11 @@
- role: user/editors/neovim
tags: neovim
# Directory for temporary files
- role: user/tmpfiles
become: true
tags: tmpfiles
# Configure git
- role: user/git
tags: git

View file

@ -0,0 +1,2 @@
---
user_tmpfiles_retention: "7d"

View file

@ -0,0 +1,5 @@
---
- name: Create the temporary directory
ansible.builtin.command:
cmd: systemd-tmpfiles --create
creates: /var/tmp/{{ target_user }}

View file

@ -0,0 +1,7 @@
---
- name: Create tmpfiles config
ansible.builtin.template:
src: templates/user.conf
dest: /etc/tmpfiles.d/user.conf
mode: 0644
notify: "Create the temporary directory"

View file

@ -0,0 +1 @@
d /var/tmp/{{ target_user }} 0640 {{ target_user }} {{ target_group }} {{ user_tmpfiles_retention }}