Saltstack Official Nginx Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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 /etc/nginx/.htpasswd:
  7. cmd.run:
  8. - creates: /etc/nginx/.htpasswd
  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 %}