2014-06-18 11:57:05 +02:00
|
|
|
{% from "nginx/map.jinja" import nginx with context %}
|
2013-08-21 21:01:51 +02:00
|
|
|
{% set htauth = nginx.get('htpasswd', '/etc/nginx/.htpasswd') -%}
|
|
|
|
|
|
|
|
htpasswd:
|
|
|
|
pkg.installed:
|
2014-06-18 11:57:05 +02:00
|
|
|
- name: {{ nginx.apache_utils }}
|
2013-08-21 21:01:51 +02:00
|
|
|
|
2016-11-16 11:18:15 +01:00
|
|
|
make sure {{ htauth }} exists:
|
|
|
|
file.exists:
|
|
|
|
- name: {{ htauth }}
|
|
|
|
|
2013-08-21 21:01:51 +02:00
|
|
|
{% for name, user in pillar.get('users', {}).items() %}
|
|
|
|
{% if user['webauth'] is defined -%}
|
|
|
|
|
|
|
|
nginx_user_{{name}}:
|
|
|
|
module.run:
|
|
|
|
- name: basicauth.adduser
|
|
|
|
- user: {{ name }}
|
|
|
|
- passwd: {{ user['webauth'] }}
|
|
|
|
- path: {{ htauth }}
|
|
|
|
- require:
|
|
|
|
- pkg: htpasswd
|
|
|
|
|
|
|
|
{% endif -%}
|
2016-11-16 11:18:15 +01:00
|
|
|
{% endfor %}
|