---
{%- from "samba/map.jinja" import samba with context %}
{%- from "samba/map.jinja" import users with context %}

{%- for user in users %}
samba-user-{{ user.name }}:
{%- if user.enabled %}
  pdbedit.managed:
{%- else %}
  pdbedit.absent:
{%- endif %}
    - name: {{ user.name }}
    - login: {{ user.name }}
    - password: "{{ user.password }}"
    - password_hashed: false
    - require:
      - pkg: samba-pkg
{%- endfor %}