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.

пре 10 година
12345678910111213141516171819202122232425262728293031323334
  1. {% set nginx = pillar.get('nginx', {}) -%}
  2. {% set log_dir = nginx.get('log_dir', '/var/log/nginx') -%}
  3. {% set logger_types = ('access', 'error') %}
  4. {% for log_type in logger_types %}
  5. {{ log_dir }}/{{ log_type }}.log:
  6. file.absent
  7. nginx-logger-{{ log_type }}:
  8. file:
  9. - managed
  10. - name: /etc/init.d/nginx-logger-{{ log_type }}
  11. - template: jinja
  12. - user: root
  13. - group: root
  14. - mode: 755
  15. - source:
  16. - salt://nginx/templates/{{ grains['os_family'] }}-sysvinit-logger.jinja
  17. - salt://nginx/templates/sysvinit-logger.jinja
  18. - context:
  19. type: {{ log_type }}
  20. service:
  21. - running
  22. - enable: True
  23. - restart: True
  24. - require:
  25. - file: nginx-logger-{{ log_type }}
  26. - require_in:
  27. - service: nginx
  28. {% endfor %}
  29. /etc/logrotate.d/nginx:
  30. file.absent