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
938B

  1. # nginx.service
  2. #
  3. # Manages the nginx service.
  4. {% from 'nginx/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.src
  9. {% else %}
  10. - nginx.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/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.src
  26. {% else %}
  27. - sls: nginx.pkg
  28. {% endif %}
  29. - listen:
  30. {% if nginx.install_from_source %}
  31. - cmd: nginx_install
  32. {% else %}
  33. - pkg: nginx_install
  34. {% endif %}