2014-10-18 07:33:57 +02:00
|
|
|
{% set nginx = pillar.get('nginx', {}) -%}
|
|
|
|
{% set log_dir = nginx.get('log_dir', '/var/log/nginx') -%}
|
|
|
|
|
2014-10-08 20:44:15 +02:00
|
|
|
{% set logger_types = ('access', 'error') %}
|
|
|
|
|
|
|
|
{% for log_type in logger_types %}
|
2014-10-18 07:33:57 +02:00
|
|
|
{{ log_dir }}/{{ log_type }}.log:
|
2014-10-08 20:44:15 +02:00
|
|
|
file.absent
|
|
|
|
|
|
|
|
nginx-logger-{{ log_type }}:
|
|
|
|
file:
|
|
|
|
- managed
|
|
|
|
- name: /etc/init.d/nginx-logger-{{ log_type }}
|
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 755
|
2014-10-20 10:59:16 +02:00
|
|
|
- source:
|
|
|
|
- salt://nginx/templates/{{ grains['os_family'] }}-sysvinit-logger.jinja
|
|
|
|
- salt://nginx/templates/sysvinit-logger.jinja
|
2014-10-08 20:44:15 +02:00
|
|
|
- context:
|
|
|
|
type: {{ log_type }}
|
|
|
|
service:
|
|
|
|
- running
|
|
|
|
- enable: True
|
2014-10-18 07:33:57 +02:00
|
|
|
- restart: True
|
2014-10-08 20:44:15 +02:00
|
|
|
- require:
|
|
|
|
- file: nginx-logger-{{ log_type }}
|
|
|
|
- require_in:
|
|
|
|
- service: nginx
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
/etc/logrotate.d/nginx:
|
|
|
|
file.absent
|