Saltstack Official Nginx Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

package.sls 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {% set use_upstart = pillar.get('nginx', {}).get('use_upstart', true) %}
  2. {% if use_upstart %}
  3. nginx-old-init:
  4. file:
  5. - rename
  6. - name: /usr/share/nginx/init.d
  7. - source: /etc/init.d/nginx
  8. - require_in:
  9. - file: nginx
  10. cmd:
  11. - wait
  12. - name: dpkg-divert --divert /usr/share/nginx/init.d --add /etc/init.d/nginx
  13. - require:
  14. - module: nginx-old-init
  15. - watch:
  16. - file: nginx-old-init
  17. - require_in:
  18. - file: nginx
  19. module:
  20. - wait
  21. - name: cmd.run
  22. - cmd: kill `cat /var/run/nginx.pid`
  23. - watch:
  24. - file: nginx-old-init
  25. - require_in:
  26. - file: nginx
  27. nginx-old-init-disable:
  28. cmd:
  29. - wait
  30. - name: update-rc.d -f nginx remove
  31. - require:
  32. - module: nginx-old-init
  33. - watch:
  34. - file: nginx-old-init
  35. {% endif %}
  36. nginx:
  37. pkg.installed:
  38. - name: nginx
  39. {% if use_upstart %}
  40. file:
  41. - managed
  42. - name: /etc/init/nginx.conf
  43. - template: jinja
  44. - user: root
  45. - group: root
  46. - mode: 440
  47. - source: salt://nginx/templates/upstart.jinja
  48. - require:
  49. - pkg: nginx
  50. - file: nginx-old-init
  51. - module: nginx-old-init
  52. {% endif %}
  53. service:
  54. - running
  55. - enable: True
  56. - restart: True
  57. - watch:
  58. {% if use_upstart %}
  59. - file: nginx
  60. {% endif %}
  61. - file: /etc/nginx/nginx.conf
  62. - file: /etc/nginx/conf.d/default.conf
  63. - file: /etc/nginx/conf.d/example_ssl.conf
  64. - pkg: nginx