Saltstack Official Nginx Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

service.sls 1.2KB

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 %}