1
0
forked from infra/ansible

xrdp_apphost: Consolidate common application tasks

This commit consolidates common tasks like user creation which is
needed by all applications into a single file.
This commit is contained in:
Thomas Basler 2022-01-09 19:11:56 +01:00
parent 541c061c7d
commit a1a3091507
5 changed files with 54 additions and 83 deletions

View File

@ -0,0 +1,51 @@
---
- name: Create Application groups
group: name={{ item.value.group }}
with_dict:
- "{{ xrdp_applications }}"
- name: Create Application users
user: name={{ item.value.user }} password={{ item.value.pass | password_hash('sha512', item.value.salt) }} home=/home/{{ item.value.user }} group={{ item.value.group }}
with_dict:
- "{{ xrdp_applications }}"
- name: Create Application .xsession
template: src={{ item.value.user }}_xsession.j2 dest=/home/{{ item.value.user }}/.xsession
with_dict:
- "{{ xrdp_applications }}"
- name: Create Application data directories
file: path=/home/{{ item.value.user }}/data state=directory mode=0755 owner={{ item.value.user }} group={{ item.value.group }}
with_dict:
- "{{ xrdp_applications }}"
- name: Create info directory
file:
path: "/home/{{ item.value.user }}/data/{{ info_folder_name }}"
state: directory
mode: 0444
owner: root
group: root
with_dict:
- "{{ xrdp_applications }}"
- name: Create file cleanup cron
cron:
name: "Delete files older than 30 days"
minute: "0"
hour: "5"
job: "find /home/{{ item.value.user }}/data -type f -mtime +30 ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item.value.user }}"
with_dict:
- "{{ xrdp_applications }}"
- name: Create directory cleanup cron
cron:
name: "Delete empty directories"
minute: "1"
hour: "5"
job: "find /home/{{ item.value.user }}/data -type d -empty ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item.value.user }}"
with_dict:
- "{{ xrdp_applications }}"

View File

@ -22,23 +22,3 @@
- winetricks
- wine32
- xfwm4
- name: Create Estlcam group
group: name={{ xrdp_applications.Estlcam.group }}
- name: Create Estlcam user
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
template: src=estlcam_xsession.j2 dest=/home/{{ xrdp_applications.Estlcam.user }}/.xsession
- name: Create Estlcam data directory
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
file:
path: "/home/{{ xrdp_applications.Estlcam.user }}/data/{{ info_folder_name }}"
state: directory
mode: 0444
owner: root
group: root

View File

@ -6,26 +6,6 @@
- libpulse-mainloop-glib0
- libnss3
- name: Create LightBurn group
group: name={{ xrdp_applications.LightBurn.group }}
- name: Create LightBurn user
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
template: src=lightburn_xsession.j2 dest=/home/{{ xrdp_applications.LightBurn.user }}/.xsession
- name: Create LightBurn data directory
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
file:
path: "/home/{{ xrdp_applications.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={{ xrdp_applications.LightBurn.checksum }} mode=0755
notify: Install LightBurn

View File

@ -7,13 +7,13 @@
line: "UMASK 027"
state: present
- include: xrdp.yml
- include: app_common.yml
- include: samba.yml
- include: lightburn.yml
- include: estlcam.yml
- include: slicer.yml
- include: samba.yml
- name: Create tsadmin group
group: name={{ tsadmin_group }}
@ -33,23 +33,3 @@
- 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.value.user }}/data -type f -mtime +30 ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item.value.user }}"
with_dict:
- "{{ xrdp_applications }}"
- name: Create directory cleanup cron
cron:
name: "Delete empty directories"
minute: "1"
hour: "5"
job: "find /home/{{ item.value.user }}/data -type d -empty ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item.value.user }}"
with_dict:
- "{{ xrdp_applications }}"

View File

@ -5,25 +5,5 @@
name:
- libgtk2.0-0
- name: Create Slic3r group
group: name={{ xrdp_applications.Slicer.group }}
- name: Create Slic3r user
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
template: src=slicer_xsession.j2 dest=/home/{{ xrdp_applications.Slicer.user }}/.xsession
- name: Create Slic3r data directory
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
file:
path: "/home/{{ xrdp_applications.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={{ xrdp_applications.Slicer.checksum }} mode=0755