73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
---
|
|
- name: Install the Samba and additional packages
|
|
apt:
|
|
name: "{{ ubuntu_samba_packages }}"
|
|
state: present
|
|
update_cache: yes
|
|
become: yes
|
|
- name: Copy the Customize smb.conf file
|
|
become: yes
|
|
template:
|
|
src: etc_samba_smb.conf.j2
|
|
dest: /etc/samba/smb.conf
|
|
backup: yes
|
|
# notify: Restart Samba
|
|
|
|
- name: Create Samba users restricted group
|
|
group:
|
|
name: "{{ samba_group_name }}"
|
|
state: present
|
|
become: yes
|
|
- name: Add the User(s) to Samba group
|
|
user:
|
|
name: "{{ item.name }}"
|
|
groups: "{{ samba_group_name }}"
|
|
append: yes
|
|
become: yes
|
|
with_items: "{{ samba_users }}"
|
|
|
|
- name: Create Samba Password for User(s)
|
|
shell: "(echo {{ item.smbpasswd }}; echo {{ item.smbpasswd }}) | smbpasswd -s -a {{ item.name }}"
|
|
with_items: "{{ samba_users }}"
|
|
become: yes
|
|
|
|
- name: "Check that {{ public_share_path }} exist"
|
|
stat:
|
|
path: "{{ public_share_path }}"
|
|
register: public_dir_exists
|
|
|
|
- name: "Create {{ public_share_path }} directory"
|
|
become: yes
|
|
file:
|
|
state: directory
|
|
path: "{{ public_share_path }}"
|
|
owner: nobody
|
|
group: nogroup
|
|
mode: 0755
|
|
recurse: yes
|
|
when: public_dir_exists.stat.exists == False
|
|
|
|
- name: "Check that {{ private_share_path }} exist"
|
|
stat:
|
|
path: "{{ private_share_path }}"
|
|
register: private_dir_exists
|
|
|
|
- name: "Create {{ private_share_path }} directory"
|
|
become: yes
|
|
file:
|
|
state: directory
|
|
path: "{{ private_share_path }}"
|
|
owner: root
|
|
group: "{{ samba_group_name }}"
|
|
mode: 1770
|
|
when: private_dir_exists.stat.exists == False
|
|
- name: copy genfiles script
|
|
copy:
|
|
src: "{{ role_path }}/files/genfiles.sh"
|
|
dest: "/home/{{ def_username }}/scripts/genfiles.sh"
|
|
owner: "{{ def_username }}"
|
|
group: "{{ def_username }}"
|
|
mode: a+x
|
|
tags: samba_genfiles
|
|
notify: Generate Samba Files
|