xrdp_apphost: Moved configuration to dictionary

This allows config and user generation using loops
This commit is contained in:
Thomas Basler 2022-01-09 18:19:16 +01:00
parent 2d645a13f4
commit 541c061c7d
12 changed files with 75 additions and 112 deletions

View File

@ -23,30 +23,36 @@ xrdp_ls_btn_cancel_y_pos: 370
info_folder_name: "___Files\ older\ than\ 30\ days\ will\ be\ automatically\ deleted" info_folder_name: "___Files\ older\ than\ 30\ days\ will\ be\ automatically\ deleted"
lightburn_user: lightburn xrdp_applications:
lightburn_group: lightburn LightBurn:
lightburn_pass: fckgw01lightburn user: lightburn
lightburn_salt: $1$SomeSalt$ group: lightburn
pass: fckgw01lightburn
salt: $1$SomeSalt$
lightburn_checksum: sha256:30d3cd573f5036edf74922ce56515304e668c345b5921fa0786248a8cc4be048 checksum: sha256:30d3cd573f5036edf74922ce56515304e668c345b5921fa0786248a8cc4be048
lightburn_version: 1.0.04 version: 1.0.04
lightburn_url: https://github.com/LightBurnSoftware/deployment/releases/download/{{ lightburn_version }}/LightBurn-Linux64-v{{ lightburn_version }}.run
lightburn_target: /home/{{ lightburn_user }}/LightBurn-Linux64-v{{ lightburn_version }}.run
estlcam_user: estlcam Estlcam:
estlcam_group: estlcam user: estlcam
estlcam_pass: fckgw01estlcam group: estlcam
estlcam_salt: $1$SomeSalt$ pass: fckgw01estlcam
salt: $1$SomeSalt$
slicer_user: slicer Slicer:
slicer_group: slicer user: slicer
slicer_pass: fckgw01slicer group: slicer
slicer_salt: $1$SomeSalt$ pass: fckgw01slicer
salt: $1$SomeSalt$
slicer_checksum: sha256:b6c34157ff2acffae5b39a1997f5694e9ca4717d5c9b370f75a6728eeadb9cab checksum: sha256:b6c34157ff2acffae5b39a1997f5694e9ca4717d5c9b370f75a6728eeadb9cab
slicer_version: 2.4.0+linux-x64-202112211614 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 lightburn_url: https://github.com/LightBurnSoftware/deployment/releases/download/{{ xrdp_applications.LightBurn.version }}/LightBurn-Linux64-v{{ xrdp_applications.LightBurn.version }}.run
lightburn_target: /home/{{ xrdp_applications.LightBurn.user }}/LightBurn-Linux64-v{{ xrdp_applications.LightBurn.version }}.run
slicer_url: https://github.com/prusa3d/PrusaSlicer/releases/download/version_2.4.0/PrusaSlicer-{{ xrdp_applications.Slicer.version }}.AppImage
slicer_target: /home/{{ xrdp_applications.Slicer.user }}/PrusaSlicer-{{ xrdp_applications.Slicer.version }}.AppImage
tsadmin_user: tsadmin tsadmin_user: tsadmin
tsadmin_group: tsadmin tsadmin_group: tsadmin

View File

@ -6,7 +6,7 @@
- name: Install LightBurn - name: Install LightBurn
shell: "{{ lightburn_target }}" shell: "{{ lightburn_target }}"
become: yes become: yes
become_user: "{{ lightburn_user }}" become_user: "{{ xrdp_applications.LightBurn.user }}"
- name: Reload smbd - name: Reload smbd
service: name=smbd state=reloaded service: name=smbd state=reloaded

View File

@ -24,20 +24,20 @@
- xfwm4 - xfwm4
- name: Create Estlcam group - name: Create Estlcam group
group: name={{ estlcam_group }} group: name={{ xrdp_applications.Estlcam.group }}
- name: Create Estlcam user - name: Create Estlcam user
user: name={{ estlcam_user }} password={{ estlcam_pass | password_hash('sha512', estlcam_salt) }} home=/home/{{ estlcam_user }} group={{ estlcam_group }} user: name={{ xrdp_applications.Estlcam.user }} password={{ xrdp_applications.Estlcam.pass | password_hash('sha512', xrdp_applications.Estlcam.salt) }} home=/home/{{ xrdp_applications.Estlcam.user }} group={{ xrdp_applications.Estlcam.group }}
- name: Create Estlcam .xsession - name: Create Estlcam .xsession
template: src=estlcam_xsession.j2 dest=/home/{{ estlcam_user }}/.xsession template: src=estlcam_xsession.j2 dest=/home/{{ xrdp_applications.Estlcam.user }}/.xsession
- name: Create Estlcam data directory - name: Create Estlcam data directory
file: path=/home/{{ estlcam_user }}/data state=directory mode=0755 owner={{ estlcam_user }} group={{ estlcam_group }} file: path=/home/{{ xrdp_applications.Estlcam.user }}/data state=directory mode=0755 owner={{ xrdp_applications.Estlcam.user }} group={{ xrdp_applications.Estlcam.group }}
- name: Create info directory - name: Create info directory
file: file:
path: "/home/{{ estlcam_user }}/data/{{ info_folder_name }}" path: "/home/{{ xrdp_applications.Estlcam.user }}/data/{{ info_folder_name }}"
state: directory state: directory
mode: 0444 mode: 0444
owner: root owner: root

View File

@ -7,25 +7,25 @@
- libnss3 - libnss3
- name: Create LightBurn group - name: Create LightBurn group
group: name={{ lightburn_group }} group: name={{ xrdp_applications.LightBurn.group }}
- name: Create LightBurn user - name: Create LightBurn user
user: name={{ lightburn_user }} password={{ lightburn_pass | password_hash('sha512', lightburn_salt) }} home=/home/{{ lightburn_user }} group={{ lightburn_group }} user: name={{ xrdp_applications.LightBurn.user }} password={{ xrdp_applications.LightBurn.pass | password_hash('sha512', xrdp_applications.LightBurn.salt) }} home=/home/{{ xrdp_applications.LightBurn.user }} group={{ xrdp_applications.LightBurn.group }}
- name: Create LightBurn .xsession - name: Create LightBurn .xsession
template: src=lightburn_xsession.j2 dest=/home/{{ lightburn_user }}/.xsession template: src=lightburn_xsession.j2 dest=/home/{{ xrdp_applications.LightBurn.user }}/.xsession
- name: Create LightBurn data directory - name: Create LightBurn data directory
file: path=/home/{{ lightburn_user }}/data state=directory mode=0755 owner={{ lightburn_user }} group={{ lightburn_group }} file: path=/home/{{ xrdp_applications.LightBurn.user }}/data state=directory mode=0755 owner={{ xrdp_applications.LightBurn.user }} group={{ xrdp_applications.LightBurn.group }}
- name: Create info directory - name: Create info directory
file: file:
path: "/home/{{ lightburn_user }}/data/{{ info_folder_name }}" path: "/home/{{ xrdp_applications.LightBurn.user }}/data/{{ info_folder_name }}"
state: directory state: directory
mode: 0444 mode: 0444
owner: root owner: root
group: root group: root
- name: Download LightBurn binary - name: Download LightBurn binary
get_url: url={{ lightburn_url }} dest={{ lightburn_target }} checksum={{ lightburn_checksum }} mode=0755 get_url: url={{ lightburn_url }} dest={{ lightburn_target }} checksum={{ xrdp_applications.LightBurn.checksum }} mode=0755
notify: Install LightBurn notify: Install LightBurn

View File

@ -25,13 +25,11 @@
lineinfile: lineinfile:
dest: /etc/sudoers dest: /etc/sudoers
state: present state: present
regexp: '^{{ tsadmin_user }} ALL=({{ item }}) NOPASSWD: ALL' regexp: '^{{ tsadmin_user }} ALL=({{ item.value.user }}) NOPASSWD: ALL'
line: '{{ tsadmin_user }} ALL=({{ item }}) NOPASSWD: ALL' line: '{{ tsadmin_user }} ALL=({{ item.value.user }}) NOPASSWD: ALL'
validate: visudo -cf %s validate: visudo -cf %s
with_items: with_dict:
- "{{ estlcam_user }}" - "{{ xrdp_applications }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"
- name: Create tsadmin_user .xsession - name: Create tsadmin_user .xsession
template: src=tsadmin_xsession.j2 dest=/home/{{ tsadmin_user }}/.xsession template: src=tsadmin_xsession.j2 dest=/home/{{ tsadmin_user }}/.xsession
@ -41,21 +39,17 @@
name: "Delete files older than 30 days" name: "Delete files older than 30 days"
minute: "0" minute: "0"
hour: "5" hour: "5"
job: "find /home/{{ item }}/data -type f -mtime +30 ! -name \"{{ info_folder_name }}\" -delete" job: "find /home/{{ item.value.user }}/data -type f -mtime +30 ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item }}" user: "{{ item.value.user }}"
with_items: with_dict:
- "{{ estlcam_user }}" - "{{ xrdp_applications }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"
- name: Create directory cleanup cron - name: Create directory cleanup cron
cron: cron:
name: "Delete empty directories" name: "Delete empty directories"
minute: "1" minute: "1"
hour: "5" hour: "5"
job: "find /home/{{ item }}/data -type d -empty ! -name \"{{ info_folder_name }}\" -delete" job: "find /home/{{ item.value.user }}/data -type d -empty ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item }}" user: "{{ item.value.user }}"
with_items: with_dict:
- "{{ estlcam_user }}" - "{{ xrdp_applications }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"

View File

@ -6,24 +6,24 @@
- libgtk2.0-0 - libgtk2.0-0
- name: Create Slic3r group - name: Create Slic3r group
group: name={{ slicer_group }} group: name={{ xrdp_applications.Slicer.group }}
- name: Create Slic3r user - name: Create Slic3r user
user: name={{ slicer_user }} password={{ slicer_pass | password_hash('sha512', slicer_salt) }} home=/home/{{ slicer_user }} group={{ slicer_group }} user: name={{ xrdp_applications.Slicer.user }} password={{ xrdp_applications.Slicer.pass | password_hash('sha512', xrdp_applications.Slicer.salt) }} home=/home/{{ xrdp_applications.Slicer.user }} group={{ xrdp_applications.Slicer.group }}
- name: Create Slic3r .xsession - name: Create Slic3r .xsession
template: src=slicer_xsession.j2 dest=/home/{{ slicer_user }}/.xsession template: src=slicer_xsession.j2 dest=/home/{{ xrdp_applications.Slicer.user }}/.xsession
- name: Create Slic3r data directory - name: Create Slic3r data directory
file: path=/home/{{ slicer_user }}/data state=directory mode=0755 owner={{ slicer_user }} group={{ slicer_group }} file: path=/home/{{ xrdp_applications.Slicer.user }}/data state=directory mode=0755 owner={{ xrdp_applications.Slicer.user }} group={{ xrdp_applications.Slicer.group }}
- name: Create info directory - name: Create info directory
file: file:
path: "/home/{{ slicer_user }}/data/{{ info_folder_name }}" path: "/home/{{ xrdp_applications.Slicer.user }}/data/{{ info_folder_name }}"
state: directory state: directory
mode: 0444 mode: 0444
owner: root owner: root
group: root group: root
- name: Download Slic3r binary - name: Download Slic3r binary
get_url: url={{ slicer_url }} dest={{ slicer_target }} checksum={{ slicer_checksum }} mode=0755 get_url: url={{ slicer_url }} dest={{ slicer_target }} checksum={{ xrdp_applications.Slicer.checksum }} mode=0755

View File

@ -2,4 +2,4 @@
export WINEPREFIX=~/.wine32 export WINEPREFIX=~/.wine32
xfwm4 & xfwm4 &
exec wine "/home/{{ estlcam_user }}/.wine32/drive_c/Program Files/Estlcam11/Estlcam.exe" exec wine "/home/{{ xrdp_applications.Estlcam.user }}/.wine32/drive_c/Program Files/Estlcam11/Estlcam.exe"

View File

@ -1,4 +1,4 @@
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
matchbox-window-manager & matchbox-window-manager &
exec /home/{{ lightburn_user }}/.local/share/LightBurn/LightBurn exec /home/{{ xrdp_applications.LightBurn.user }}/.local/share/LightBurn/LightBurn

View File

@ -1,4 +1,4 @@
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
matchbox-window-manager & matchbox-window-manager &
exec /home/{{ slicer_user }}/PrusaSlicer-{{ slicer_version }}.AppImage exec /home/{{ xrdp_applications.Slicer.user }}/PrusaSlicer-{{ xrdp_applications.Slicer.version }}.AppImage

View File

@ -236,38 +236,17 @@
# to the drivers directory for these users to have write rights in it # to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin ; write list = root, @lpadmin
# LightBurn share {% for app, config in xrdp_applications.items() %}
[lightburn] # {{ app}} share
comment = LightBurn data folder [{{ app | lower }}]
path = /home/{{ lightburn_user }}/data comment = {{ app }} data folder
path = /home/{{ config.user }}/data
browseable = yes browseable = yes
read only = no read only = no
guest ok = yes guest ok = yes
create mask = 0600 create mask = 0600
directory mask = 0700 directory mask = 0700
force user = {{ lightburn_user }} force user = {{ config.user }}
hide dot files = yes hide dot files = yes
# Estlcam share {% endfor %}
[estlcam]
comment = Estlcam data folder
path = /home/{{ estlcam_user }}/data
browseable = yes
read only = no
guest ok = yes
create mask = 0600
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

View File

@ -1,7 +1,7 @@
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
xhost si:localuser:{{ lightburn_user }} {% for app, config in xrdp_applications.items() %}
xhost si:localuser:{{ estlcam_user }} xhost si:localuser:{{ config.user }}
xhost si:localuser:{{ slicer_user }} {% endfor %}
xfwm4 & xfwm4 &
exec xterm exec xterm

View File

@ -182,33 +182,17 @@ tcutils=true
; Some session types such as Xorg, X11rdp and Xvnc start a display server. ; Some session types such as Xorg, X11rdp and Xvnc start a display server.
; Startup command-line parameters for the display server are configured ; Startup command-line parameters for the display server are configured
; in sesman.ini. See and configure also sesman.ini. ; in sesman.ini. See and configure also sesman.ini.
[LightBurn] {% for app, config in xrdp_applications.items() %}
name=LightBurn [{{ app }}]
name={{ app }}
lib=libxup.so lib=libxup.so
username={{ lightburn_user }} username={{ config.user }}
password={{ lightburn_pass }} password={{ config.pass }}
ip=127.0.0.1
port=-1
code=20
[Estlcam]
name=Estlcam
lib=libxup.so
username={{ estlcam_user }}
password={{ estlcam_pass }}
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 ip=127.0.0.1
port=-1 port=-1
code=20 code=20
{% endfor %}
[Xorg] [Xorg]
name=Xorg name=Xorg
lib=libxup.so lib=libxup.so