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_map_to_guest: 'bad user'
samba_load_printers: 'no' samba_load_printers: 'no'
samba_load_homes: 'no' samba_load_homes: 'no'
samba_shares_root: '/srv/shares'

View File

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

View File

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