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.

12345678910111213141516171819202122232425
  1. include:
  2. - nginx.ng.service
  3. {% set certificates_path = salt['pillar.get']('nginx:ng:certificates_path', '/etc/nginx/ssl') %}
  4. {%- for domain in salt['pillar.get']('nginx:ng:certificates', {}).keys() %}
  5. nginx_{{ domain }}_ssl_certificate:
  6. file.managed:
  7. - name: {{ certificates_path }}/{{ domain }}.crt
  8. - makedirs: True
  9. - contents_pillar: nginx:ng:certificates:{{ domain }}:public_cert
  10. - watch_in:
  11. - service: nginx_service
  12. {% if salt['pillar.get']("nginx:ng:certificates:{}:private_key".format(domain)) %}
  13. nginx_{{ domain }}_ssl_key:
  14. file.managed:
  15. - name: {{ certificates_path }}/{{ domain }}.key
  16. - mode: 600
  17. - makedirs: True
  18. - contents_pillar: nginx:ng:certificates:{{ domain }}:private_key
  19. - watch_in:
  20. - service: nginx_service
  21. {% endif %}
  22. {%- endfor %}