Saltstack Official Nginx Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users.sls 588B

1234567891011121314151617181920212223242526
  1. {% from "nginx/map.jinja" import nginx with context %}
  2. {% set htauth = nginx.get('htpasswd', '/etc/nginx/.htpasswd') -%}
  3. htpasswd:
  4. pkg.installed:
  5. - name: {{ nginx.apache_utils }}
  6. make sure {{ htauth }} exists:
  7. file.managed:
  8. - name: {{ htauth }}
  9. - makedirs: True
  10. {% for name, user in pillar.get('users', {}).items() %}
  11. {% if user['webauth'] is defined -%}
  12. nginx_user_{{name}}:
  13. module.run:
  14. - name: basicauth.adduser
  15. - user: {{ name }}
  16. - passwd: {{ user['webauth'] }}
  17. - path: {{ htauth }}
  18. - require:
  19. - pkg: htpasswd
  20. {% endif -%}
  21. {% endfor %}