update...
This commit is contained in:
@@ -52,37 +52,39 @@
|
||||
- profile
|
||||
|
||||
|
||||
# 1) Für jeden NIS-User prüfen, ob eine lokale _profile existiert
|
||||
- name: (nis-user-systemfiles.yml) stat user _profile
|
||||
# 1) Für jeden NIS-User prüfen, ob eine lokale _profile.j2 existiert
|
||||
- name: (nis-user-systemfiles.yml) stat user _profile.j2
|
||||
ansible.builtin.stat:
|
||||
path: "{{ inventory_dir }}/files/{{ nis_domain }}/homedirs/{{ item.name }}/_profile"
|
||||
path: "{{ inventory_dir }}/files/{{ nis_domain }}/homedirs/DEFAULT/_profile.j2"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
loop: "{{ nis_user }}"
|
||||
register: profile_stats
|
||||
register: profile_template_stats
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
# 2) Falls NIS-User _profile vorhanden, kopieren
|
||||
- name: (nis-user-systemfiles.yml) copy .profile if it exists
|
||||
ansible.builtin.copy:
|
||||
src: "{{ inventory_dir }}/files/{{ nis_domain }}/homedirs/{{ user.name }}/_profile"
|
||||
# 2) Falls _profile.j2 vorhanden, .profile aus Template rendern
|
||||
- name: (nis-user-systemfiles.yml) template .profile if _profile.j2 exists
|
||||
ansible.builtin.template:
|
||||
src: "{{ inventory_dir }}/files/{{ nis_domain }}/homedirs/DEFAULT/_profile.j2"
|
||||
dest: "~{{ user.name }}/.profile"
|
||||
owner: "{{ user.name }}"
|
||||
group: "{{ user.name }}"
|
||||
mode: "0644"
|
||||
become: true
|
||||
loop: "{{ nis_user | zip(profile_stats.results) | list }}"
|
||||
loop: "{{ nis_user | zip(profile_template_stats.results) | list }}"
|
||||
loop_control:
|
||||
label: "{{ user.name }}"
|
||||
when:
|
||||
when:
|
||||
- stat_result.stat.exists | bool
|
||||
vars:
|
||||
user: "{{ item.0 }}"
|
||||
user: "{{ item.0 }}"
|
||||
stat_result: "{{ item.1 }}"
|
||||
tags: [bash]
|
||||
|
||||
|
||||
|
||||
|
||||
# --
|
||||
# Copy .bashrc
|
||||
# ---
|
||||
|
||||
Reference in New Issue
Block a user