40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
---
|
|
|
|
- name: (user-systemfiles.yml) Check if users file '.profile.ORIG' exists
|
|
stat:
|
|
path: "~{{ item.name }}/.profile.ORIG"
|
|
register: profile_user_orig_exists
|
|
loop: "{{ nis_user }}"
|
|
loop_control:
|
|
label: '{{ item.name }}'
|
|
when:
|
|
- item.is_samba_user is defined and item.is_samba_user|bool
|
|
tags:
|
|
- profile
|
|
|
|
- name: (user-systemfiles.yml) Backup existing users .profile file
|
|
command: cp -a ~{{ item.item.name }}/.profile ~{{ item.item.name }}/.profile.ORIG
|
|
loop: "{{ profile_user_orig_exists.results }}"
|
|
loop_control:
|
|
label: '{{ item.item.name }}'
|
|
when:
|
|
- item.is_samba_user is defined and item.is_samba_user|bool
|
|
- item.stat.exists == False
|
|
tags:
|
|
- profile
|
|
|
|
- name: (user-systemfiles.yml) Create new users .profile file
|
|
template:
|
|
src: user_homedirs/dot.profile.j2
|
|
dest: "~{{ item.name }}/.profile"
|
|
owner: "{{ item.name }}"
|
|
group: "{{ item.name }}"
|
|
mode: 0644
|
|
loop: "{{ nis_user }}"
|
|
loop_control:
|
|
label: '{{ item.name }}'
|
|
when:
|
|
- item.is_samba_user is defined and item.is_samba_user|bool
|
|
tags:
|
|
- profile
|