Put all shares under a root directory and provide more sane defaults

This commit is contained in:
Bert Van Vreckem 2015-03-14 00:32:37 +01:00
parent 8549204093
commit fba843d672
3 changed files with 22 additions and 15 deletions

View File

@ -9,3 +9,4 @@ samba_passdb_backend: 'tdbsam'
samba_map_to_guest: 'bad user'
samba_load_printers: 'no'
samba_load_homes: 'no'
samba_shares_root: '/srv/shares'

View File

@ -26,10 +26,10 @@
with_items: samba_shares
file:
state: directory
path: "{{ item.path }}"
path: "{{ samba_shares_root}}/{{ item.name }}"
owner: root
group: "{{ item.force_group }}"
mode: "{{ item.directory_mode }}"
group: "{{ item.force_group|default('users') }}"
mode: "{{ item.directory_mode|default('0775') }}"
setype: "{{ item.setype|default('samba_share_t') }}"
when: samba_shares is defined
tags: samba
@ -45,7 +45,7 @@
file:
state: link
path: "/var/www/html/{{ item.name }}"
src: "{{ item.path }}"
src: "{{ samba_shares_root }}/{{ item.name }}"
with_items: samba_shares
tags: samba

View File

@ -48,17 +48,23 @@
{% if samba_shares is defined %}
{% for share in samba_shares %}
[{{ share.name }}]
{% if share.comment is defined %}
comment = {{ share.comment }}
path = {{ share.path }}
public = {{ share.public }}
{% endif %}
path = {{ samba_shares_root }}/{{ share.name }}
public = {{ share.public|default('no') }}
{% if share.write_list is defined %}
write list = {{ share.write_list }}
{% endif %}
force group = +{{ share.force_group }}
create mask = {{ share.create_mask }}
create mode = {{ share.create_mode }}
force create mode = {{ share.force_create_mode }}
directory mask = {{ share.directory_mask }}
directory mode = {{ share.directory_mode }}
force directory mode = {{ share.force_directory_mode }}
{% if share.force_group is defined %}
force group = {{ share.force_group }}
{% endif %}
create mask = {{ share.create_mask|default('0664') }}
create mode = {{ share.create_mode|default('0664') }}
force create mode = {{ share.force_create_mode|default('0664') }}
directory mask = {{ share.directory_mask|default('0775') }}
directory mode = {{ share.directory_mode|default('0775') }}
force directory mode = {{ share.force_directory_mode|default('0775') }}
{% endfor %}
{% endif%}