Saltstack Official Apache 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.

68 lines
2.2KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {%- set tplroot = tpldir.split('/')[0] %}
  4. {%- set sls_service_running = tplroot ~ '.service.running' %}
  5. {%- from tplroot ~ "/map.jinja" import apache with context %}
  6. include:
  7. - {{ sls_service_running }}
  8. {%- for site, cert in salt['pillar.get']('apache:sites', {}).items() %}
  9. {%- if cert.SSLCertificateKeyFile is defined and cert.SSLCertificateKeyFile_content is defined %}
  10. apache_cert_config_install_{{ site }}_key_file:
  11. file.managed:
  12. - name: {{ cert.SSLCertificateKeyFile }}
  13. - contents_pillar: apache:sites:{{ site }}:SSLCertificateKeyFile_content
  14. - makedirs: True
  15. - mode: 600
  16. - user: {{ apache.rootuser }}
  17. - group: {{ apache.rootgroup }}
  18. - watch_in:
  19. - module: apache-service-running-reload
  20. - require_in:
  21. - module: apache-service-running-restart
  22. - module: apache-service-running-reload
  23. - service: apache-service-running
  24. {%- endif %}
  25. {%- if cert.SSLCertificateFile is defined and cert.SSLCertificateFile_content is defined %}
  26. apache_cert_config_install_{{ site }}_cert_file:
  27. file.managed:
  28. - name: {{ cert.SSLCertificateFile }}
  29. - contents_pillar: apache:sites:{{ site }}:SSLCertificateFile_content
  30. - makedirs: True
  31. - mode: 600
  32. - user: {{ apache.rootuser }}
  33. - group: {{ apache.rootgroup }}
  34. - watch_in:
  35. - module: apache-service-running-reload
  36. - require_in:
  37. - module: apache-service-running-restart
  38. - module: apache-service-running-reload
  39. - service: apache-service-running
  40. {%- endif %}
  41. {%- if cert.SSLCertificateChainFile is defined and cert.SSLCertificateChainFile_content is defined %}
  42. apache_cert_config_install_{{ site }}_bundle_file:
  43. file.managed:
  44. - name: {{ cert.SSLCertificateChainFile }}
  45. - contents_pillar: apache:sites:{{ site }}:SSLCertificateChainFile_content
  46. - makedirs: True
  47. - mode: 600
  48. - user: {{ apache.rootuser }}
  49. - group: {{ apache.rootgroup }}
  50. - watch_in:
  51. - module: apache-service-running-reload
  52. - require_in:
  53. - module: apache-service-running-restart
  54. - module: apache-service-running-reload
  55. - service: apache-service-running
  56. {%- endif %}
  57. {%- endfor %}