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.

пре 10 година
пре 7 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # nginx.service
  2. #
  3. # Manages the nginx service.
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
  6. {%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}
  7. {% set service_function = {True:'running', False:'dead'}.get(nginx.service.enable) %}
  8. include:
  9. {% if nginx.install_from_source %}
  10. - nginx.src
  11. {% else %}
  12. - nginx.pkg
  13. {% endif %}
  14. {% if nginx.install_from_source %}
  15. nginx_systemd_service_file:
  16. file.managed:
  17. - name: /lib/systemd/system/nginx.service
  18. - source: {{ files_switch(['nginx.service'],
  19. 'nginx_systemd_service_file'
  20. )
  21. }}
  22. {% endif %}
  23. nginx_service:
  24. service.{{ service_function }}:
  25. {{ sls_block(nginx.service.opts) }}
  26. - name: {{ nginx.lookup.service }}
  27. - enable: {{ nginx.service.enable }}
  28. - require:
  29. {% if nginx.install_from_source %}
  30. - sls: nginx.src
  31. {% else %}
  32. - sls: nginx.pkg
  33. {% endif %}
  34. - listen:
  35. {% if nginx.install_from_source %}
  36. - cmd: nginx_install
  37. {% else %}
  38. - pkg: nginx_install
  39. {% endif %}
  40. {% if nginx.check_config_before_apply %}
  41. - onlyif: /usr/sbin/nginx -t
  42. {% endif %}