split smb into a subformula

This commit is contained in:
2023-12-22 14:46:35 -05:00
parent fb3a0471b7
commit 92334f5aa1
2 changed files with 29 additions and 27 deletions

View File

@@ -1,29 +1,4 @@
samba_packages:
pkg.installed:
- pkgs:
- samba
- samba-common-bin
smbd:
service.running:
- enable: True
- watch:
- file: /etc/samba/smb.conf
- pkg: samba_packages
/etc/samba/smb.conf:
file.managed:
- source: 'salt://samba/files/smb.conf.jinja'
- template: jinja
{# generate these with print(hashlib.new('md4', "password".encode('utf-16le')).hexdigest()) #}
{% for user, passw in salt.pillar.get('samba:users', {}).items() %}
samba_{{user}}:
pdbedit.managed:
- name: {{user}}
- password: {{passw}}
- password_hashed: True
{% endfor %}
include:
- samba.smbd
- samba.wsdd

27
samba/smbd.sls Normal file
View File

@@ -0,0 +1,27 @@
samba_packages:
pkg.installed:
- pkgs:
- samba
- samba-common-bin
smbd:
service.running:
- enable: True
- watch:
- file: /etc/samba/smb.conf
- pkg: samba_packages
/etc/samba/smb.conf:
file.managed:
- source: 'salt://samba/files/smb.conf.jinja'
- template: jinja
- check_cmd: /usr/bin/testparm -d 0 -s
{# generate these with print(hashlib.new('md4', "password".encode('utf-16le')).hexdigest()) #}
{% for user, passw in salt.pillar.get('samba:users', {}).items() %}
samba_{{user}}:
pdbedit.managed:
- name: {{user}}
- password: {{passw}}
- password_hashed: True
{% endfor %}