Add smb.conf to absible. Add new users. Add new shares.
This commit is contained in:
@ -44,3 +44,8 @@
|
||||
name: rpcbind
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
|
||||
- name: Reload samba config
|
||||
shell: smbcontrol all reload-config
|
||||
when:
|
||||
- "groups['samba_server']|string is search(inventory_hostname)"
|
||||
|
@ -85,6 +85,15 @@
|
||||
tags:
|
||||
- sudoers
|
||||
|
||||
# tags supported inside samba-server-shares.yml:
|
||||
#
|
||||
# samba-shares
|
||||
# samba-config
|
||||
- import_tasks: samba-server.yml
|
||||
when: "groups['samba_server']|string is search(inventory_hostname)"
|
||||
tags:
|
||||
- samba-server
|
||||
|
||||
#- import_tasks: mount_samba_shares.yml
|
||||
# when: "groups['client_pc']|string is search(inventory_hostname)"
|
||||
# tags:
|
||||
|
41
roles/common/tasks/samba-server.yml
Normal file
41
roles/common/tasks/samba-server.yml
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
|
||||
|
||||
- name: (samba-server.yml) Ensure samba share directories exists
|
||||
file:
|
||||
path: "/data/shares/{{ item.name }}"
|
||||
owner: "root"
|
||||
group: "{{ item.group }}"
|
||||
mode: '2770'
|
||||
state: directory
|
||||
with_items: "{{ samba_shares }}"
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
tags:
|
||||
- samba-shares
|
||||
|
||||
|
||||
- name: (samba-server.yml) Checki if file '/etc/samba/smbconf.ORIG' exists
|
||||
stat:
|
||||
path: /etc/samba/smb.conf.ORIG
|
||||
register: etc_samba_smb_conf_ORIG
|
||||
tags:
|
||||
- samba-config
|
||||
|
||||
- name: (samba-server.yml) Backup installation version of file '/etc/samba/smb.conf'
|
||||
command: cp -a /etc/samba/smb.conf /etc/samba/smb.conf.ORIG
|
||||
when: etc_samba_smb_conf_ORIG.stat.exists == False
|
||||
tags:
|
||||
- samba-config
|
||||
|
||||
- name: (samba-server.yml) Create new smb.conf from template smb.conf.j2
|
||||
template:
|
||||
src: etc/samba/smb.conf.j2
|
||||
dest: /etc/samba/smb.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
#backup: yes
|
||||
notify: "Reload samba config"
|
||||
tags:
|
||||
- samba-config
|
1048
roles/common/templates/etc/samba/smb.conf.j2
Normal file
1048
roles/common/templates/etc/samba/smb.conf.j2
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user