From 3d2d0475c2d3894c01c6a5b94388a8b758c4fe96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BE=D0=BB=D0=B3=D0=B8=D0=B9=20=D0=90=D1=80=D1=82?= =?UTF-8?q?=D1=91=D0=BC?= Date: Fri, 25 Aug 2023 11:22:05 +0300 Subject: [PATCH] mod add users --- ansible_deploy_dc/add_samba_users.yml | 11 ++++++++--- ansible_deploy_dc/samba_users.yml | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ansible_deploy_dc/add_samba_users.yml b/ansible_deploy_dc/add_samba_users.yml index 3bee7b3..c657a8f 100644 --- a/ansible_deploy_dc/add_samba_users.yml +++ b/ansible_deploy_dc/add_samba_users.yml @@ -16,13 +16,18 @@ var: user_list.stdout_lines - name: Создаются пользователи домена - ansible.builtin.command: samba-tool user {{ samba_user_mode }} {{ item.name }} {{ item.password }} + ansible.builtin.command: | + samba-tool user {{ samba_user_mode }} \ + {{ item.username }} {{ item.password }} \ + --login-shell=/bin/bash \ + --gecos='{{ item.fname }} {{ item.sname }}' \ + --given-name={{ item.fname }} --surname={{ item.sname }} loop: "{{ samba_users }}" - when: (not item.name in user_list.stdout_lines) and (samba_user_mode != 'delete') + when: (not item.username in user_list.stdout_lines) and (samba_user_mode != 'delete') no_log: true - name: Удаляются пользователи домена - ansible.builtin.command: samba-tool user {{ samba_user_mode }} {{ item.name }} + ansible.builtin.command: samba-tool user {{ samba_user_mode }} {{ item.username }} loop: "{{ samba_users }}" when: samba_user_mode == 'delete' register: status diff --git a/ansible_deploy_dc/samba_users.yml b/ansible_deploy_dc/samba_users.yml index a9750dd..9599dab 100644 --- a/ansible_deploy_dc/samba_users.yml +++ b/ansible_deploy_dc/samba_users.yml @@ -1,6 +1,10 @@ samba_users: - - name: ivanov + - username: ivanov password: P@ssw0rd + fname: Иван + sname: Иванов - - name: petrov - password: P@ssw0rd \ No newline at end of file + - username: petrov + password: P@ssw0rd + fname: Пётр + sname: Петров \ No newline at end of file