paulbsd-salt/states/nginx/auth.sls
Paul Lecuq 1b59cdacdd * Update salt states
- bl module updated
- borg state updated
- config state updated
- netbox state updated
- nginx state updated
- misc updates
2022-02-21 13:52:46 +01:00

26 lines
684 B
Plaintext

---
{%- from "nginx/map.jinja" import nginx with context %}
{%- from "nginx/map.jinja" import users with context %}
{%- for key, value in users.items() %}
{%- if value.state == 'present' %}
nginx-auth-present-{{ key }}:
webutil.user_exists:
- name: {{ key }}
{%- if value.password is defined %}
- password: {{ value.password }}
{%- endif %}
- htpasswd_file: {{ nginx.config.dir }}/auth/htpasswd
- require:
- file: nginx-config-dir-auth
{%- else %}
nginx-auth-absent-{{ key }}:
webutil.user_absent:
- name: {{ key }}
- htpasswd_file: {{ nginx.config.dir }}/auth/htpasswd
- require:
- file: nginx-config-dir-auth
{%- endif %}
{%- endfor %}