Samba init.sls file



samba_service_install:
  pkg.installed:
    - name: samba
  service.running:
    - name: smbd
    - enable: True
    - require:
      - pkg: samba_service_install

samba_user:
  user.present:
    - name: tweedledum
    - shell: /usr/sbin/nologin
    - home: /home/tweedledum
    - groups:
      - sambashare

create_share_folder:
  file.directory:
    - name: /home/tweedledum/smb_share
    - user: tweedledum
    - group: sambashare
    - mode: 770
    - makedirs: True
    - require:
      - user: samba_user

add_config:
  file.managed:
    - name: /etc/samba/smb.conf
    - source: salt://samba/smb.conf
    - require:
      - pkg: samba_service_install

set_smb_pass:
  pdbedit.managed:
    - name: tweedledum
    - password: 0CB6948805F797BF2A82807973B89537
    - password_hashed: True
    - require:
      - pkg: samba_service_install
      - user: samba_user

reload_smb:
  service.running:
    - name: smbd
    - enable: True
    - reload: True
    - require:
      - pkg: samba_service_install