diff --git a/defaults/main.yml b/defaults/main.yml index 8e21df1..544bf06 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,3 +11,5 @@ samba_load_printers: false samba_load_homes: false samba_create_varwww_symlinks: false samba_shares_root: '/srv/shares' +samba_shares: [] +samba_users: [] diff --git a/tasks/main.yml b/tasks/main.yml index 70c26d5..2ad0390 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -35,11 +35,11 @@ owner: root group: root mode: '0755' - when: samba_shares is defined + when: samba_shares tags: samba - name: Create share directories - with_items: samba_shares + with_items: "{{ samba_shares }}" file: state: directory path: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}" @@ -47,7 +47,7 @@ group: "{{ item.group|default('users') }}" mode: "{{ item.directory_mode|default('0775') }}" setype: "{{ item.setype|default('samba_share_t') }}" - when: samba_shares is defined + when: samba_shares tags: samba - name: Check if /var/www/html exists @@ -62,7 +62,7 @@ state: link path: "/var/www/html/{{ item.name }}" src: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}" - with_items: samba_shares + with_items: "{{ samba_shares }}" tags: samba - name: Samba configuration @@ -94,6 +94,6 @@ (pdbedit -L | grep {{ item.name }} 2>&1 > /dev/null) \ || (echo {{ item.password }}; echo {{ item.password }}) \ | smbpasswd -s -a {{ item.name }} - with_items: samba_users - when: samba_users is defined + with_items: "{{ samba_users }}" + when: samba_users tags: samba