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.

common.sls 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. include:
  2. - nrpe
  3. /usr/share/nginx:
  4. file:
  5. - directory
  6. {% for filename in ('default', 'example_ssl') %}
  7. /etc/nginx/conf.d/{{ filename }}.conf:
  8. file.absent
  9. {% endfor %}
  10. {% set logger_types = ('access', 'error') %}
  11. {% for log_type in logger_types %}
  12. /var/log/nginx/{{ log_type }}.log:
  13. file.absent
  14. nginx-logger-{{ log_type }}:
  15. file:
  16. - managed
  17. - name: /etc/init/nginx-logger-{{ log_type }}.conf
  18. - template: jinja
  19. - user: root
  20. - group: root
  21. - mode: 440
  22. - source: salt://nginx/templates/upstart_logger.jinja
  23. - context:
  24. type: {{ log_type }}
  25. service:
  26. - running
  27. - enable: True
  28. - require:
  29. - file: nginx-logger-{{ log_type }}
  30. - require_in:
  31. - service: nginx
  32. {% endfor %}
  33. /etc/logrotate.d/nginx:
  34. file:
  35. - absent
  36. {% for dir in ['sites-available', 'sites-enabled'] -%}
  37. /etc/nginx/{{ dir }}:
  38. file.directory:
  39. - user: www-data
  40. - group: www-data
  41. - mode: 0755
  42. {% endfor -%}
  43. /etc/nginx:
  44. file.directory:
  45. - user: root
  46. - group: root
  47. /etc/nginx/nginx.conf:
  48. file:
  49. - managed
  50. - template: jinja
  51. - user: root
  52. - group: root
  53. - mode: 440
  54. - source: salt://nginx/templates/config.jinja
  55. - require:
  56. - file: /etc/nginx
  57. {% for dir in ('sites-enabled', 'sites-available') %}
  58. /etc/nginx/{{ dir }}:
  59. file.directory:
  60. - user: root
  61. - group: root
  62. {% endfor -%}