31 lines
824 B
YAML
31 lines
824 B
YAML
---
|
|
|
|
# ---
|
|
# - default user/groups
|
|
# ---
|
|
|
|
- name: (samba-user.yml) Check if samba user exists for nis user
|
|
shell: pdbedit -w -L | awk -F":" '{ print $1 }' | grep '{{ item.name }}'
|
|
register: samba_nis_user_present
|
|
changed_when: "samba_nis_user_present.rc == 1"
|
|
failed_when: "samba_nis_user_present.rc > 1"
|
|
loop: "{{ nis_user }}"
|
|
loop_control:
|
|
label: '{{ item.name }}'
|
|
when:
|
|
- item.is_samba_user is defined and item.is_samba_user|bool
|
|
tags:
|
|
- samba-user
|
|
|
|
- name: (samba-user.yml) Add nis user to samba (with nis users password)
|
|
shell: >
|
|
(echo '{{ item.item.password }}'; echo '{{ item.item.password }}')
|
|
| smbpasswd -s -a {{ item.item.name }}
|
|
loop: "{{ samba_nis_user_present.results }}"
|
|
when: item.changed
|
|
loop_control:
|
|
label: '{{ item.item.name }}'
|
|
tags:
|
|
- samba-user
|
|
|