Skip to content

Commit

Permalink
Merge pull request #192 from cradle8810/148_pdbedit
Browse files Browse the repository at this point in the history
Add user hayato into smb-db using pdbedit (to tm)
  • Loading branch information
cradle8810 authored Sep 6, 2024
2 parents a44c50e + 5a39f8f commit b4ac9bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ansible-lint-ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# ignore create user for hayato in samba
tasks/skylark/samba.yml no-handler
tasks/tm/samba.yml no-handler
24 changes: 24 additions & 0 deletions tasks/tm/samba.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 29 in tasks/tm/samba.yml

View workflow job for this annotation

GitHub Actions / AnsibleLint

no-handler

Tasks that run when changed should likely be handlers.
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

0 comments on commit b4ac9bc

Please sign in to comment.