From f565853cd2c2182e536dc95ca0013b6a70804e95 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sat, 8 Jan 2022 03:39:36 +0100 Subject: [PATCH] xrdp_apphost: Add configuration for Slic3r --- roles/xrdp_apphost/defaults/main.yml | 10 +++++++++ roles/xrdp_apphost/tasks/main.yml | 2 ++ roles/xrdp_apphost/tasks/slicer.yml | 21 +++++++++++++++++++ .../xrdp_apphost/templates/slicer_xsession.j2 | 4 ++++ roles/xrdp_apphost/templates/smb.conf.j2 | 12 +++++++++++ .../templates/tsadmin_xsession.j2 | 1 + roles/xrdp_apphost/templates/xrdp.ini.j2 | 9 ++++++++ 7 files changed, 59 insertions(+) create mode 100644 roles/xrdp_apphost/tasks/slicer.yml create mode 100644 roles/xrdp_apphost/templates/slicer_xsession.j2 diff --git a/roles/xrdp_apphost/defaults/main.yml b/roles/xrdp_apphost/defaults/main.yml index 08cfc45..cd9ae8a 100644 --- a/roles/xrdp_apphost/defaults/main.yml +++ b/roles/xrdp_apphost/defaults/main.yml @@ -36,6 +36,16 @@ estlcam_group: estlcam estlcam_pass: fckgw01estlcam estlcam_salt: $1$SomeSalt$ +slicer_user: slicer +slicer_group: slicer +slicer_pass: fckgw01slicer +slicer_salt: $1$SomeSalt$ + +slicer_checksum: sha256:b6c34157ff2acffae5b39a1997f5694e9ca4717d5c9b370f75a6728eeadb9cab +slicer_version: 2.4.0+linux-x64-202112211614 +slicer_url: https://github.com/prusa3d/PrusaSlicer/releases/download/version_2.4.0/PrusaSlicer-{{ slicer_version }}.AppImage +slicer_target: /home/{{ slicer_user }}/PrusaSlicer-{{ slicer_version }}.AppImage + tsadmin_user: tsadmin tsadmin_group: tsadmin tsadmin_pass: fckgw01tsadmin diff --git a/roles/xrdp_apphost/tasks/main.yml b/roles/xrdp_apphost/tasks/main.yml index b0e9d14..e88d118 100644 --- a/roles/xrdp_apphost/tasks/main.yml +++ b/roles/xrdp_apphost/tasks/main.yml @@ -3,6 +3,7 @@ - include: xrdp.yml - include: lightburn.yml - include: estlcam.yml +- include: slicer.yml - include: samba.yml @@ -22,6 +23,7 @@ with_items: - "{{ estlcam_user }}" - "{{ lightburn_user }}" + - "{{ slicer_user }}" - name: Create tsadmin_user .xsession template: src=tsadmin_xsession.j2 dest=/home/{{ tsadmin_user }}/.xsession diff --git a/roles/xrdp_apphost/tasks/slicer.yml b/roles/xrdp_apphost/tasks/slicer.yml new file mode 100644 index 0000000..5261589 --- /dev/null +++ b/roles/xrdp_apphost/tasks/slicer.yml @@ -0,0 +1,21 @@ +--- + +- name: Install Slic3r dependencies + apt: + name: + - libgtk2.0-0 + +- name: Create Slic3r group + group: name={{ slicer_group }} + +- name: Create Slic3r user + user: name={{ slicer_user }} password={{ slicer_pass | password_hash('sha512', slicer_salt) }} home=/home/{{ slicer_user }} group={{ slicer_group }} + +- name: Create Slic3r .xsession + template: src=slicer_xsession.j2 dest=/home/{{ slicer_user }}/.xsession + +- name: Create Slic3r data directory + file: path=/home/{{ slicer_user }}/data state=directory mode=0755 owner={{ slicer_user }} group={{ slicer_group }} + +- name: Download Slic3r binary + get_url: url={{ slicer_url }} dest={{ slicer_target }} checksum={{ slicer_checksum }} mode=0755 diff --git a/roles/xrdp_apphost/templates/slicer_xsession.j2 b/roles/xrdp_apphost/templates/slicer_xsession.j2 new file mode 100644 index 0000000..fc427d1 --- /dev/null +++ b/roles/xrdp_apphost/templates/slicer_xsession.j2 @@ -0,0 +1,4 @@ +{{ ansible_managed | comment }} + +matchbox-window-manager & +exec /home/{{ slicer_user }}/PrusaSlicer-{{ slicer_version }}.AppImage \ No newline at end of file diff --git a/roles/xrdp_apphost/templates/smb.conf.j2 b/roles/xrdp_apphost/templates/smb.conf.j2 index b9d0164..3e5df72 100644 --- a/roles/xrdp_apphost/templates/smb.conf.j2 +++ b/roles/xrdp_apphost/templates/smb.conf.j2 @@ -259,3 +259,15 @@ directory mask = 0700 force user = {{ estlcam_user }} hide dot files = yes + +# Slicer share +[slicer] + comment = Slicer data folder + path = /home/{{ slicer_user }}/data + browseable = yes + read only = no + guest ok = yes + create mask = 0600 + directory mask = 0700 + force user = {{ slicer_user }} + hide dot files = yes \ No newline at end of file diff --git a/roles/xrdp_apphost/templates/tsadmin_xsession.j2 b/roles/xrdp_apphost/templates/tsadmin_xsession.j2 index 111e7d7..d7f2461 100644 --- a/roles/xrdp_apphost/templates/tsadmin_xsession.j2 +++ b/roles/xrdp_apphost/templates/tsadmin_xsession.j2 @@ -2,5 +2,6 @@ xhost si:localuser:{{ lightburn_user }} xhost si:localuser:{{ estlcam_user }} +xhost si:localuser:{{ slicer_user }} xfwm4 & exec xterm \ No newline at end of file diff --git a/roles/xrdp_apphost/templates/xrdp.ini.j2 b/roles/xrdp_apphost/templates/xrdp.ini.j2 index 498f87b..e75d61c 100644 --- a/roles/xrdp_apphost/templates/xrdp.ini.j2 +++ b/roles/xrdp_apphost/templates/xrdp.ini.j2 @@ -200,6 +200,15 @@ ip=127.0.0.1 port=-1 code=20 +[Slicer] +name=Slicer +lib=libxup.so +username={{ slicer_user }} +password={{ slicer_pass }} +ip=127.0.0.1 +port=-1 +code=20 + [Xorg] name=Xorg lib=libxup.so