Commit d6a472d1 authored by Jocelyn Delalande's avatar Jocelyn Delalande

added a cifs-server role

parent 6a262984
- name: Restart samba
service: name=samba state=restarted
\ No newline at end of file
- name: Install required package
apt: pkg=samba state=installed
- name: Put config file
template: src=smb.conf.j2 dest=/etc/samba/smb.conf
notify: Restart samba
- name: Ensure authorized users exist
user: name="{{ item.login }}" group=nogroup createhome=no
with_items: cifs_server_users
- name: Create the share directories if needed
file: name="{{ item.path }}" owner="{{ item.owner|default('nobody') }}" state=directory
with_items: cifs_server_shares
- name: Create password for those samba users
shell: echo -ne {{ item.password }}\n{{ item.password }}\n | smbpasswd -s -a {{ item.login }}
with_items: cifs_server_users
- name: Ensure Samba is running and set to start on boot.
service: name=samba state=started enabled=yes
[global]
workgroup = {{ cifs_server_workgroup }}
server string = %h server
dns proxy = no
; name resolve order = lmhosts host wins bcast
#### Debugging/Accounting ####
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
{% for share in cifs_server_shares %}
[{{ share.name }}]
path = {{ share.path }}
browseable = yes
guest account = nobody
guest ok = {{ share.guest_ok|default('no') }}
write ok = {{ share.write_ok|default('no') }}
{% if share.owner |default(None) %}
valid users = {{ share.owner }}
{% endif %}
#force user = jukebox
#force group = jukebox
{% endfor %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment