--- {%- from "nginx/map.jinja" import nginx with context %} {%- for user in salt['pillar.get']('htpasswds') %} {%- if user.state == 'present' %} nginx-auth-present-{{ user.name }}: webutil.user_exists: - name: {{ user.name }} {%- if user.password is defined %} - password: {{ user.password }} {%- endif %} - htpasswd_file: {{ nginx.config.dir }}/auth/htpasswd - require: - file: nginx-config-dir-auth {%- else %} nginx-auth-absent-{{ user.name }}: webutil.user_absent: - name: {{ user.name }} - htpasswd_file: {{ nginx.config.dir }}/auth/htpasswd - require: - file: nginx-config-dir-auth {%- endif %} {%- endfor %}