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:
|
2023-07-12 00:02:17 +02:00
|
|
|
name: "{{ samba.dependencies }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
|
2023-07-12 00:02:17 +02:00
|
|
|
- name: Add group "{{ samba.group }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
group:
|
2023-07-12 00:02:17 +02:00
|
|
|
name: "{{ samba.group }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Change permission on share
|
|
|
|
file:
|
2023-07-12 00:02:17 +02:00
|
|
|
path: "{{ samba.media_dir }}"
|
|
|
|
group: "{{ samba.group }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
mode: "2770"
|
|
|
|
become: true
|
|
|
|
|
2023-07-12 00:02:17 +02:00
|
|
|
- name: Add user "{{ samba.user }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
user:
|
2023-07-12 00:02:17 +02:00
|
|
|
name: "{{ samba.user }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
shell: "/sbin/nologin"
|
2023-07-12 00:02:17 +02:00
|
|
|
groups: "{{ samba.group }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
append: true
|
|
|
|
become: true
|
2022-12-29 22:45:17 +01:00
|
|
|
register: new_user
|
2022-12-27 21:51:41 +01:00
|
|
|
|
2023-07-12 00:02:17 +02:00
|
|
|
- name: Add password to "{{ samba.user }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
shell:
|
2023-07-12 00:02:17 +02:00
|
|
|
cmd: smbpasswd -a "{{ samba.user }}"
|
|
|
|
stdin: "{{ host.samba.password }}\n{{ host.samba.password }}"
|
2022-12-27 21:51:41 +01:00
|
|
|
become: true
|
2022-12-29 22:45:17 +01:00
|
|
|
when: new_user.changed
|
2022-12-27 21:51:41 +01:00
|
|
|
|