2022-12-27 21:51:41 +01:00
|
|
|
---
|
|
|
|
- name: Update and upgrade packages
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
upgrade: true
|
|
|
|
autoremove: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Install Samba dependencies
|
|
|
|
apt:
|
|
|
|
name: "{{ smb_deps }}"
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Add group "{{smb_group}}"
|
|
|
|
group:
|
|
|
|
name: "{{smb_group}}"
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Change permission on share
|
|
|
|
file:
|
|
|
|
path: "{{ smb_media_dir }}"
|
|
|
|
group: "{{smb_group}}"
|
|
|
|
mode: "2770"
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Add user "{{ smb_user }}"
|
|
|
|
user:
|
|
|
|
name: "{{ smb_user }}"
|
|
|
|
shell: "/sbin/nologin"
|
|
|
|
groups: "{{ smb_group }}"
|
|
|
|
append: true
|
|
|
|
become: true
|
2022-12-29 22:45:17 +01:00
|
|
|
register: new_user
|
2022-12-27 21:51:41 +01:00
|
|
|
|
|
|
|
- name: Add password to "{{ smb_user }}"
|
|
|
|
shell:
|
|
|
|
cmd: smbpasswd -a "{{ smb_user }}"
|
|
|
|
stdin: "{{ vault_smb_user_password }}\n{{ vault_smb_user_password }}"
|
|
|
|
become: true
|
2022-12-29 22:45:17 +01:00
|
|
|
when: new_user.changed
|
2022-12-27 21:51:41 +01:00
|
|
|
|