ansible/roles/xrdp_apphost/tasks/main.yml
Thomas Basler 2d645a13f4 xrdp_apphost: Implemented cleanup of old files
All files older than 30 days as well as empty folders
will be automatically deleted.
2022-06-19 21:47:48 +02:00

62 lines
1.6 KiB
YAML

---
- name: Set Default umask for Users
lineinfile:
dest: '/etc/login.defs'
regexp: "UMASK"
line: "UMASK 027"
state: present
- include: xrdp.yml
- include: lightburn.yml
- include: estlcam.yml
- include: slicer.yml
- include: samba.yml
- name: Create tsadmin group
group: name={{ tsadmin_group }}
- name: Create tsadmin_user
user: name={{ tsadmin_user }} password={{ tsadmin_pass | password_hash('sha512', tsadmin_salt) }} home=/home/{{ tsadmin_user }} group={{ tsadmin_group }}
- name: Allow 'tsadmin_user' group to have passwordless sudo to other users
lineinfile:
dest: /etc/sudoers
state: present
regexp: '^{{ tsadmin_user }} ALL=({{ item }}) NOPASSWD: ALL'
line: '{{ tsadmin_user }} ALL=({{ item }}) NOPASSWD: ALL'
validate: visudo -cf %s
with_items:
- "{{ estlcam_user }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"
- name: Create tsadmin_user .xsession
template: src=tsadmin_xsession.j2 dest=/home/{{ tsadmin_user }}/.xsession
- name: Create file cleanup cron
cron:
name: "Delete files older than 30 days"
minute: "0"
hour: "5"
job: "find /home/{{ item }}/data -type f -mtime +30 ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item }}"
with_items:
- "{{ estlcam_user }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"
- name: Create directory cleanup cron
cron:
name: "Delete empty directories"
minute: "1"
hour: "5"
job: "find /home/{{ item }}/data -type d -empty ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item }}"
with_items:
- "{{ estlcam_user }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"