Saltstack Official Nginx Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

89 líneas
2.1KB

  1. {% from "nginx/map.jinja" import nginx with context %}
  2. {% set use_upstart = pillar.get('nginx', {}).get('use_upstart', true) %}
  3. {% if use_upstart %}
  4. nginx-old-init:
  5. file:
  6. - rename
  7. - name: /usr/share/nginx/init.d
  8. - source: /etc/init.d/nginx
  9. - require_in:
  10. - file: nginx
  11. cmd:
  12. - wait
  13. - name: dpkg-divert --divert /usr/share/nginx/init.d --add /etc/init.d/nginx
  14. - require:
  15. - module: nginx-old-init
  16. - watch:
  17. - file: nginx-old-init
  18. - require_in:
  19. - file: nginx
  20. module:
  21. - wait
  22. - name: cmd.run
  23. - cmd: kill `cat /var/run/nginx.pid`
  24. - watch:
  25. - file: nginx-old-init
  26. - require_in:
  27. - file: nginx
  28. nginx-old-init-disable:
  29. cmd:
  30. - wait
  31. - name: update-rc.d -f nginx remove
  32. - require:
  33. - module: nginx-old-init
  34. - watch:
  35. - file: nginx-old-init
  36. {% endif %}
  37. {% if salt['grains.get']('os_family') == 'Debian' %}
  38. nginx-ppa-repo:
  39. pkgrepo.managed:
  40. - enabled: {{ salt['pillar.get']('nginx:install_from_ppa', False) }}
  41. - humanname: nginx-ppa-{{ grains['oscodename'] }}
  42. - name: deb http://ppa.launchpad.net/nginx/stable/ubuntu {{ grains['oscodename'] }} main
  43. - file: /etc/apt/sources.list.d/nginx-stable-{{ grains['oscodename'] }}.list
  44. - dist: {{ grains['oscodename'] }}
  45. - keyid: C300EE8C
  46. - keyserver: keyserver.ubuntu.com
  47. - require_in:
  48. - pkg: nginx
  49. {% endif %}
  50. nginx:
  51. pkg.installed:
  52. - name: {{ nginx.package }}
  53. {% if use_upstart %}
  54. file:
  55. - managed
  56. - name: /etc/init/nginx.conf
  57. - template: jinja
  58. - user: root
  59. - group: root
  60. - mode: 440
  61. - source: salt://nginx/templates/upstart.jinja
  62. - require:
  63. - pkg: nginx
  64. - file: nginx-old-init
  65. - module: nginx-old-init
  66. {% endif %}
  67. service:
  68. - running
  69. - enable: True
  70. - restart: True
  71. - watch:
  72. {% if use_upstart %}
  73. - file: nginx
  74. {% endif %}
  75. - file: /etc/nginx/nginx.conf
  76. - file: /etc/nginx/conf.d/default.conf
  77. - file: /etc/nginx/conf.d/example_ssl.conf
  78. - pkg: nginx
  79. # Create 'service' symlink for tab completion.
  80. {% if use_upstart %}
  81. /etc/init.d/nginx:
  82. file.symlink:
  83. - target: /lib/init/upstart-job
  84. {% endif %}