From a34e6c97155bc3f0097c988c4c96f8c61f146c07 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Fri, 1 Jan 2016 22:37:59 -0800 Subject: [PATCH 1/2] Use path if defined for share --- tasks/main.yml | 4 ++-- templates/smb.conf.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3a9f3f4..1dd8646 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -36,7 +36,7 @@ with_items: samba_shares file: state: directory - path: "{{ samba_shares_root}}/{{ item.name }}" + path: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}" owner: root group: "{{ item.group|default('users') }}" mode: "{{ item.directory_mode|default('0775') }}" @@ -55,7 +55,7 @@ file: state: link path: "/var/www/html/{{ item.name }}" - src: "{{ samba_shares_root }}/{{ item.name }}" + src: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}" with_items: samba_shares tags: samba diff --git a/templates/smb.conf.j2 b/templates/smb.conf.j2 index 2e74493..378bc9f 100644 --- a/templates/smb.conf.j2 +++ b/templates/smb.conf.j2 @@ -53,7 +53,7 @@ {% if share.comment is defined %} comment = {{ share.comment }} {% endif %} - path = {{ samba_shares_root }}/{{ share.name }} + path = {{ share.path|default([samba_shares_root,share.name]|join('/')) }} public = {{ share.public|default('no') }} {% if share.valid_users is defined %} valid users= {{ share.valid_users }} From 72a086e890ecf2e1f2ffdf8acff6b345af77148e Mon Sep 17 00:00:00 2001 From: Ian Young Date: Fri, 1 Jan 2016 23:26:51 -0800 Subject: [PATCH 2/2] Add path option to docs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 64f3b6b..28f552a 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ A complete overview of share options follows below. Only `name` is required, the | Option | Default | Comment | | :--- | :--- | :--- | | `name` | - | The name of the share. | +| `path` | /{{samba_shares_root}}/{{name}} | The path to the share directory. | | `comment` | - | A comment string for the share | | `public` | `no` | Controls read access for guest users | | `valid_users` | - | Controls read access for registered users. Use the syntax of the corresponding Samba setting. |