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.

39 lines
959B

  1. # nginx.ng.service
  2. #
  3. # Manages the nginx service.
  4. {% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
  5. {% set service_function = {True:'running', False:'dead'}.get(nginx.service.enable) %}
  6. include:
  7. {% if nginx.install_from_source %}
  8. - nginx.ng.src
  9. {% else %}
  10. - nginx.ng.pkg
  11. {% endif %}
  12. {% if nginx.install_from_source %}
  13. nginx_systemd_service_file:
  14. file.managed:
  15. - name: /lib/systemd/system/nginx.service
  16. - source: salt://nginx/ng/files/nginx.service
  17. {% endif %}
  18. nginx_service:
  19. service.{{ service_function }}:
  20. {{ sls_block(nginx.service.opts) }}
  21. - name: {{ nginx.lookup.service }}
  22. - enable: {{ nginx.service.enable }}
  23. - require:
  24. {% if nginx.install_from_source %}
  25. - sls: nginx.ng.src
  26. {% else %}
  27. - sls: nginx.ng.pkg
  28. {% endif %}
  29. - listen:
  30. {% if nginx.install_from_source %}
  31. - cmd: nginx_install
  32. {% else %}
  33. - pkg: nginx_install
  34. {% endif %}