Add smb.conf to absible. Add new users. Add new shares.

This commit is contained in:
2020-06-18 02:08:20 +02:00
parent 2cdbca8cc3
commit 3672b3962a
5 changed files with 1285 additions and 98 deletions

View File

@ -44,3 +44,8 @@
name: rpcbind
daemon_reload: yes
state: restarted
- name: Reload samba config
shell: smbcontrol all reload-config
when:
- "groups['samba_server']|string is search(inventory_hostname)"

View File

@ -85,6 +85,15 @@
tags:
- sudoers
# tags supported inside samba-server-shares.yml:
#
# samba-shares
# samba-config
- import_tasks: samba-server.yml
when: "groups['samba_server']|string is search(inventory_hostname)"
tags:
- samba-server
#- import_tasks: mount_samba_shares.yml
# when: "groups['client_pc']|string is search(inventory_hostname)"
# tags:

View File

@ -0,0 +1,41 @@
---
- name: (samba-server.yml) Ensure samba share directories exists
file:
path: "/data/shares/{{ item.name }}"
owner: "root"
group: "{{ item.group }}"
mode: '2770'
state: directory
with_items: "{{ samba_shares }}"
loop_control:
label: '{{ item.name }}'
tags:
- samba-shares
- name: (samba-server.yml) Checki if file '/etc/samba/smbconf.ORIG' exists
stat:
path: /etc/samba/smb.conf.ORIG
register: etc_samba_smb_conf_ORIG
tags:
- samba-config
- name: (samba-server.yml) Backup installation version of file '/etc/samba/smb.conf'
command: cp -a /etc/samba/smb.conf /etc/samba/smb.conf.ORIG
when: etc_samba_smb_conf_ORIG.stat.exists == False
tags:
- samba-config
- name: (samba-server.yml) Create new smb.conf from template smb.conf.j2
template:
src: etc/samba/smb.conf.j2
dest: /etc/samba/smb.conf
owner: root
group: root
mode: 0644
#backup: yes
notify: "Reload samba config"
tags:
- samba-config

File diff suppressed because it is too large Load Diff