Files
dsfin-ansible/roles/samba-server/tasks/main.yml
Pi 3eca006e87 -Fix some Samba directories
-Change genfiles handler
2019-06-12 16:10:17 -04:00

75 lines
1.8 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/pi/scripts/genfiles.sh
owner: pi
group: pi
mode: a+x
tags: samba_genfiles
notify:
- Generate Samba Files