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.

преди 6 години
преди 6 години
123456789101112131415161718192021222324252627282930
  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.managed:
  11. - name: {{ htauth }}
  12. - makedirs: True
  13. {% for name, user in pillar.get('users', {}).items() %}
  14. {% if user['webauth'] is defined -%}
  15. nginx_user_{{name}}:
  16. module.run:
  17. - name: basicauth.adduser
  18. - user: {{ name }}
  19. - passwd: {{ user['webauth'] }}
  20. - path: {{ htauth }}
  21. - require:
  22. - pkg: htpasswd
  23. {% endif -%}
  24. {% endfor %}