diff --git a/roles/xrdp_apphost/defaults/main.yml b/roles/xrdp_apphost/defaults/main.yml index cd9ae8a..8a88787 100644 --- a/roles/xrdp_apphost/defaults/main.yml +++ b/roles/xrdp_apphost/defaults/main.yml @@ -21,6 +21,8 @@ xrdp_ls_btn_ok_y_pos: 370 xrdp_ls_btn_cancel_x_pos: 237 xrdp_ls_btn_cancel_y_pos: 370 +info_folder_name: "___Files\ older\ than\ 30\ days\ will\ be\ automatically\ deleted" + lightburn_user: lightburn lightburn_group: lightburn lightburn_pass: fckgw01lightburn diff --git a/roles/xrdp_apphost/tasks/estlcam.yml b/roles/xrdp_apphost/tasks/estlcam.yml index e13790e..dd5a4eb 100644 --- a/roles/xrdp_apphost/tasks/estlcam.yml +++ b/roles/xrdp_apphost/tasks/estlcam.yml @@ -33,4 +33,12 @@ template: src=estlcam_xsession.j2 dest=/home/{{ estlcam_user }}/.xsession - name: Create Estlcam data directory - file: path=/home/{{ estlcam_user }}/data state=directory mode=0755 owner={{ estlcam_user }} group={{ estlcam_group }} \ No newline at end of file + file: path=/home/{{ estlcam_user }}/data state=directory mode=0755 owner={{ estlcam_user }} group={{ estlcam_group }} + +- name: Create info directory + file: + path: "/home/{{ estlcam_user }}/data/{{ info_folder_name }}" + state: directory + mode: 0444 + owner: root + group: root \ No newline at end of file diff --git a/roles/xrdp_apphost/tasks/lightburn.yml b/roles/xrdp_apphost/tasks/lightburn.yml index 846ad19..3e40b0d 100644 --- a/roles/xrdp_apphost/tasks/lightburn.yml +++ b/roles/xrdp_apphost/tasks/lightburn.yml @@ -18,6 +18,14 @@ - name: Create LightBurn data directory file: path=/home/{{ lightburn_user }}/data state=directory mode=0755 owner={{ lightburn_user }} group={{ lightburn_group }} +- name: Create info directory + file: + path: "/home/{{ lightburn_user }}/data/{{ info_folder_name }}" + state: directory + mode: 0444 + owner: root + group: root + - name: Download LightBurn binary get_url: url={{ lightburn_url }} dest={{ lightburn_target }} checksum={{ lightburn_checksum }} mode=0755 notify: Install LightBurn \ No newline at end of file diff --git a/roles/xrdp_apphost/tasks/main.yml b/roles/xrdp_apphost/tasks/main.yml index 5d0231e..bc66848 100644 --- a/roles/xrdp_apphost/tasks/main.yml +++ b/roles/xrdp_apphost/tasks/main.yml @@ -35,3 +35,27 @@ - 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 }}" diff --git a/roles/xrdp_apphost/tasks/slicer.yml b/roles/xrdp_apphost/tasks/slicer.yml index 5261589..39ce04f 100644 --- a/roles/xrdp_apphost/tasks/slicer.yml +++ b/roles/xrdp_apphost/tasks/slicer.yml @@ -17,5 +17,13 @@ - name: Create Slic3r data directory file: path=/home/{{ slicer_user }}/data state=directory mode=0755 owner={{ slicer_user }} group={{ slicer_group }} +- name: Create info directory + file: + path: "/home/{{ slicer_user }}/data/{{ info_folder_name }}" + state: directory + mode: 0444 + owner: root + group: root + - name: Download Slic3r binary get_url: url={{ slicer_url }} dest={{ slicer_target }} checksum={{ slicer_checksum }} mode=0755