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 626B

1234567891011121314151617181920212223242526272829
  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. touch {{ htauth }}:
  7. cmd.run:
  8. - creates: {{ htauth }}
  9. make sure {{ htauth }} exists:
  10. file.exists:
  11. - name: {{ htauth }}
  12. {% for name, user in pillar.get('users', {}).items() %}
  13. {% if user['webauth'] is defined -%}
  14. nginx_user_{{name}}:
  15. module.run:
  16. - name: basicauth.adduser
  17. - user: {{ name }}
  18. - passwd: {{ user['webauth'] }}
  19. - path: {{ htauth }}
  20. - require:
  21. - pkg: htpasswd
  22. {% endif -%}
  23. {% endfor %}