You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-homelab/roles/setup_samba/tasks/main.yml

44 lines
938 B
YAML

---
#- name: Install samba packages using apt.
# ansible.builtin.apt:
# name:
# - samba
# state: present
# update_cache: true
- name: Ensure samba group exists.
ansible.builtin.group:
name: '{{ samba_group }}'
state: present
system: true
notify: reload-samba
- name: Ensure samba user.
ansible.builtin.user:
name: '{{ samba_user }}'
comment: Samba user
group: '{{ samba_group }}'
shell: /bin/false
create_home: false
system: true
notify: reload-samba
- name: Add the User(s) to Samba group.
ansible.builtin.user:
name: '{{ item.name }}'
groups: '{{ samba_group }}'
append: true
with_items: '{{ users }}'
- name: Copy smb conf files.
ansible.builtin.copy:
src: '{{ item }}'
dest: "/etc/samba/{{ item }}"
mode: 0644
owner: "{{ samba_user }}"
group: "{{ samba_group }}"
with_items:
- smb.conf
- shares.conf
notify: reload-samba