forked from infra/ansible
Thomas Basler
a1a3091507
This commit consolidates common tasks like user creation which is needed by all applications into a single file.
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
---
|
|
|
|
- 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 }}"
|