From 57ca4330555f58970c618be94d123eb5f114cf26 Mon Sep 17 00:00:00 2001 From: Hayato Date: Fri, 6 Sep 2024 22:13:39 +0900 Subject: [PATCH 1/2] Add user hayato into smb-db using pdbedit (to tm) --- tasks/tm/samba.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tasks/tm/samba.yml b/tasks/tm/samba.yml index be82164..28b0efa 100644 --- a/tasks/tm/samba.yml +++ b/tasks/tm/samba.yml @@ -15,3 +15,27 @@ group: root mode: '0644' notify: "Restart smbd" + + +- name: Check if hayato exists + ansible.builtin.shell: + cmd: | + set -o pipefail && + pdbedit -L | grep -E '^hayato:' | wc -l + executable: /bin/bash + register: pdbedit_hayato_exist + changed_when: "( pdbedit_hayato_exist.stdout | int) != 1" + +- name: Make user hayato + ansible.builtin.shell: + cmd: | + set -o pipefail && + "echo \"{{ passwd }}\n{{ passwd }}\" | pdbedit -a {{ user }} -t" + executable: /bin/bash + register: pdbedit_hayato_created + vars: + passwd: "{{ all.vars.user[0].password }}" + user: "{{ all.vars.user[0].username }}" + changed_when: true + failed_when: false + when: pdbedit_hayato_exist.changed From 5a39f8f1f97e5fc1e6cacdddc1131f19b483ffd4 Mon Sep 17 00:00:00 2001 From: Hayato Date: Fri, 6 Sep 2024 22:16:17 +0900 Subject: [PATCH 2/2] Fix samba user adding following by ansible-lint (to tm) --- .ansible-lint-ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.ansible-lint-ignore b/.ansible-lint-ignore index 9e9aabd..147021f 100644 --- a/.ansible-lint-ignore +++ b/.ansible-lint-ignore @@ -1,2 +1,3 @@ # ignore create user for hayato in samba tasks/skylark/samba.yml no-handler +tasks/tm/samba.yml no-handler