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.

58 lines
1.4KB

  1. # nginx.passenger
  2. #
  3. # Manages installation of passenger from repo.
  4. # Requires install_from_phusionpassenger = True
  5. {%- set tplroot = tpldir.split('/')[0] %}
  6. {%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
  7. {%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}
  8. {% if salt['grains.get']('os_family') in ['Debian', 'RedHat'] %}
  9. include:
  10. - nginx.pkg
  11. - nginx.config
  12. - nginx.service
  13. {%- if nginx.snippets is defined %}
  14. - nginx.snippets
  15. {%- endif %}
  16. {%- if nginx.streams is defined %}
  17. - nginx.streams
  18. {%- endif %}
  19. - nginx.servers
  20. - nginx.certificates
  21. passenger_install:
  22. pkg.installed:
  23. - name: {{ nginx.lookup.passenger_package }}
  24. - require:
  25. - pkg: nginx_install
  26. - require_in:
  27. - service: nginx_service
  28. - file: nginx_config
  29. /etc/nginx/passenger.conf:
  30. file.absent:
  31. - require:
  32. - pkg: passenger_install
  33. passenger_config:
  34. file.managed:
  35. {{ sls_block(nginx.server.opts) }}
  36. - name: {{ nginx.lookup.passenger_config_file }}
  37. - source: {{ files_switch(['nginx.conf'],
  38. 'passenger_config_file_managed'
  39. )
  40. }}
  41. - template: jinja
  42. - context:
  43. config: {{ nginx.passenger|json() }}
  44. - watch_in:
  45. - service: nginx_service
  46. - require_in:
  47. - service: nginx_service
  48. - file: nginx_config
  49. - require:
  50. - file: /etc/nginx/passenger.conf
  51. - pkg: passenger_install
  52. {% endif %}