full variable syntax instead of deprecated bare variables; default to empty list instead of undefined variable
This commit is contained in:
parent
8407d8ea42
commit
a0b310d4ad
@ -11,3 +11,5 @@ samba_load_printers: false
|
|||||||
samba_load_homes: false
|
samba_load_homes: false
|
||||||
samba_create_varwww_symlinks: false
|
samba_create_varwww_symlinks: false
|
||||||
samba_shares_root: '/srv/shares'
|
samba_shares_root: '/srv/shares'
|
||||||
|
samba_shares: []
|
||||||
|
samba_users: []
|
||||||
|
@ -35,11 +35,11 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
when: samba_shares is defined
|
when: samba_shares
|
||||||
tags: samba
|
tags: samba
|
||||||
|
|
||||||
- name: Create share directories
|
- name: Create share directories
|
||||||
with_items: samba_shares
|
with_items: "{{ samba_shares }}"
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
path: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}"
|
path: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}"
|
||||||
@ -47,7 +47,7 @@
|
|||||||
group: "{{ item.group|default('users') }}"
|
group: "{{ item.group|default('users') }}"
|
||||||
mode: "{{ item.directory_mode|default('0775') }}"
|
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
|
||||||
tags: samba
|
tags: samba
|
||||||
|
|
||||||
- name: Check if /var/www/html exists
|
- name: Check if /var/www/html exists
|
||||||
@ -62,7 +62,7 @@
|
|||||||
state: link
|
state: link
|
||||||
path: "/var/www/html/{{ item.name }}"
|
path: "/var/www/html/{{ item.name }}"
|
||||||
src: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}"
|
src: "{{ item.path|default([samba_shares_root,item.name]|join('/')) }}"
|
||||||
with_items: samba_shares
|
with_items: "{{ samba_shares }}"
|
||||||
tags: samba
|
tags: samba
|
||||||
|
|
||||||
- name: Samba configuration
|
- name: Samba configuration
|
||||||
@ -94,6 +94,6 @@
|
|||||||
(pdbedit -L | grep {{ item.name }} 2>&1 > /dev/null) \
|
(pdbedit -L | grep {{ item.name }} 2>&1 > /dev/null) \
|
||||||
|| (echo {{ item.password }}; echo {{ item.password }}) \
|
|| (echo {{ item.password }}; echo {{ item.password }}) \
|
||||||
| smbpasswd -s -a {{ item.name }}
|
| smbpasswd -s -a {{ item.name }}
|
||||||
with_items: samba_users
|
with_items: "{{ samba_users }}"
|
||||||
when: samba_users is defined
|
when: samba_users
|
||||||
tags: samba
|
tags: samba
|
||||||
|
Loading…
Reference in New Issue
Block a user