38 lines
1007 B
YAML
38 lines
1007 B
YAML
---
|
|
|
|
# ---
|
|
# - default user/groups
|
|
# ---
|
|
|
|
- name: (samba-user.yml) Check if samba user exists for nis user
|
|
ansible.builtin.shell:
|
|
cmd: >-
|
|
set -o pipefail &&
|
|
pdbedit -w -L | awk -F":" '{ print $1 }' | grep -e "^{{ item.name }}"
|
|
executable: /bin/bash
|
|
register: common_samba_nis_user_present
|
|
changed_when: false
|
|
failed_when: common_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)
|
|
ansible.builtin.shell:
|
|
cmd: >-
|
|
set -o pipefail &&
|
|
(echo '{{ item.item.password }}'; echo '{{ item.item.password }}') |
|
|
smbpasswd -s -a {{ item.item.name }}
|
|
executable: /bin/bash
|
|
changed_when: true
|
|
loop: "{{ common_samba_nis_user_present.results }}"
|
|
when: item.rc == 1
|
|
loop_control:
|
|
label: '{{ item.item.name }}'
|
|
tags:
|
|
- samba-user
|