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.

123456789101112131415161718192021
  1. {% set nginx = pillar.get('nginx', {}) -%}
  2. {% set htauth = nginx.get('htpasswd', '/etc/nginx/.htpasswd') -%}
  3. htpasswd:
  4. pkg.installed:
  5. - name: apache2-utils
  6. {% for name, user in pillar.get('users', {}).items() %}
  7. {% if user['webauth'] is defined -%}
  8. nginx_user_{{name}}:
  9. module.run:
  10. - name: basicauth.adduser
  11. - user: {{ name }}
  12. - passwd: {{ user['webauth'] }}
  13. - path: {{ htauth }}
  14. - require:
  15. - pkg: htpasswd
  16. {% endif -%}
  17. {% endfor %}