updated samba state

This commit is contained in:
Paul 2022-10-10 10:17:01 +02:00
parent 0e36358ea8
commit 8be1f8d305
3 changed files with 20 additions and 6 deletions

View File

@ -1,6 +1,9 @@
---
{%- from "samba/map.jinja" import samba with context %}
samba-config:
ini_manage.options_present:
ini.options_present:
- name: /etc/samba/smb.conf
- sections: {{ samba.config }}
- watch_in:
- service: samba-service-smbd
- service: samba-service-nmbd

11
states/samba/service.sls Normal file
View File

@ -0,0 +1,11 @@
---
{%- from "samba/map.jinja" import samba with context %}
samba-service-smbd:
service.running:
- name: smbd
- reload: True
samba-service-nmbd:
service.running:
- name: nmbd
- restart: True

View File

@ -2,16 +2,16 @@
{%- from "samba/map.jinja" import samba with context %}
{%- from "samba/map.jinja" import users with context %}
{%- for user in users %}
samba-user-{{ user.name }}:
{%- for name, user in users.items() %}
samba-user-{{ name }}:
{%- if user.enabled %}
pdbedit.managed:
- name: {{ user.name }}
- login: {{ user.name }}
- name: {{ name }}
- login: {{ name }}
- password: "{{ user.password }}"
{%- else %}
pdbedit.absent:
- name: {{ user.name }}
- name: {{ name }}
{%- endif %}
- require:
- pkg: samba-pkg