feat(user/tmpfiles): create role for user's tmpdir
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
a87a455844
commit
7c20e9c509
5 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
2
roles/user/tmpfiles/defaults/main.yml
Normal file
2
roles/user/tmpfiles/defaults/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
user_tmpfiles_retention: "7d"
|
5
roles/user/tmpfiles/handlers/main.yml
Normal file
5
roles/user/tmpfiles/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Create the temporary directory
|
||||
ansible.builtin.command:
|
||||
cmd: systemd-tmpfiles --create
|
||||
creates: /var/tmp/{{ target_user }}
|
7
roles/user/tmpfiles/tasks/main.yml
Normal file
7
roles/user/tmpfiles/tasks/main.yml
Normal 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"
|
1
roles/user/tmpfiles/templates/user.conf
Normal file
1
roles/user/tmpfiles/templates/user.conf
Normal file
|
@ -0,0 +1 @@
|
|||
d /var/tmp/{{ target_user }} 0640 {{ target_user }} {{ target_group }} {{ user_tmpfiles_retention }}
|
Loading…
Reference in a new issue