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.

30 lines
747B

  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. - nginx.ng.install
  8. {% if nginx.install_from_source %}
  9. /lib/systemd/system/nginx.service:
  10. file.managed:
  11. - source: salt://nginx/ng/files/nginx.service
  12. {% endif %}
  13. nginx_service:
  14. service.{{ service_function }}:
  15. {{ sls_block(nginx.service.opts) }}
  16. - name: {{ nginx.lookup.service }}
  17. - enable: {{ nginx.service.enable }}
  18. - require:
  19. - sls: nginx.ng.install
  20. - watch:
  21. {% if nginx.install_from_source %}
  22. - cmd: nginx_install
  23. {% else %}
  24. - pkg: nginx_install
  25. {% endif %}