This commit is contained in:
2023-08-03 14:29:11 +02:00
parent b551e937e9
commit 4a3e23adac
5 changed files with 63 additions and 3 deletions

View File

@ -48,7 +48,7 @@
- samba-user
- system-user
- name: (samba_user.yml) Ensure samba users exists with given group membership
- name: (samba_user.yml) Ensure samba users exists in system with given group membership
user:
name: '{{ item.name }}'
state: present
@ -66,8 +66,6 @@
- samba-user
- system-user
- name: (samba-user.yml) Check if samba user exists
shell: pdbedit -w -L | awk -F":" '{ print $1 }' | grep '{{ item.name }}'
register: samba_user_present
@ -92,3 +90,36 @@
- samba-server
- samba-user
# Only on fileservers:
# zapata.opp.netz
- name: (samba_user.yml) Check if folder '/data/backup' exists using file module
stat:
path: /data/backup
register: data_backup_dir
when:
- inventory_hostname == 'zapata.opp.netz'
tags:
- samba-server
- samba-user
- system-user
- name: (samba_user.yml) Ensure folder /data/backup/<user-name> exists for all (samba) users on host zapata
file:
path: '/data/backup/{{ item.name }}'
state: directory
owner: '{{ item.name }}'
group: '{{ item.name }}'
mode: "2770"
loop: "{{ samba_user }}"
loop_control:
label: '{{ item.name }}'
when:
- inventory_hostname == 'zapata.opp.netz'
- data_backup_dir.stat.isdir is defined and data_backup_dir.stat.isdir
tags:
- samba-server
- samba-user
- system-user