Paul Lecuq
1b59cdacdd
- bl module updated - borg state updated - config state updated - netbox state updated - nginx state updated - misc updates
26 lines
684 B
Plaintext
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 %} |