2015-01-21 05:00:07 -05:00
|
|
|
# vim: sts=2 ts=2 sw=2 et ai
|
|
|
|
{% from "logrotate/map.jinja" import logrotate with context %}
|
2015-10-12 11:21:04 -04:00
|
|
|
{% set jobs = salt['pillar.get']('logrotate:jobs', {}) %}
|
2015-01-21 05:00:07 -05:00
|
|
|
|
|
|
|
include:
|
|
|
|
- logrotate
|
|
|
|
|
2015-10-12 11:22:12 -04:00
|
|
|
{% for key,value in jobs.items() %}
|
2015-05-05 09:20:54 -04:00
|
|
|
logrotate_{{key}}:
|
2015-01-21 05:00:07 -05:00
|
|
|
file.managed:
|
|
|
|
- name: {{ logrotate.include_dir }}/{{ key.split("/")[-1] }}
|
|
|
|
- source: salt://logrotate/templates/job.tmpl
|
|
|
|
- template: jinja
|
|
|
|
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
|
|
|
|
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
|
|
|
|
- mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }}
|
|
|
|
- require:
|
|
|
|
- pkg: logrotate
|
|
|
|
- watch_in:
|
|
|
|
- service: {{ logrotate.service }}
|
|
|
|
- context:
|
2015-05-05 09:20:54 -04:00
|
|
|
{% if value is mapping %}
|
2015-11-19 22:33:35 -05:00
|
|
|
path: {{ value.get('path', []) }}
|
2015-05-05 09:20:54 -04:00
|
|
|
data: {{ value.get('config', []) }}
|
|
|
|
{% else %}
|
2015-01-21 05:00:07 -05:00
|
|
|
path: {{ key }}
|
|
|
|
data: {{ value }}
|
2015-05-05 09:20:54 -04:00
|
|
|
{% endif %}
|
2015-01-21 05:00:07 -05:00
|
|
|
{%- endfor -%}
|