diff --git a/logrotate/jobs.sls b/logrotate/jobs.sls index 6b154b4..b4b9f47 100644 --- a/logrotate/jobs.sls +++ b/logrotate/jobs.sls @@ -5,10 +5,10 @@ include: - logrotate -{% for key,value in jobs.iteritems() %} -{{key}}: +{% for job_name,value in jobs.iteritems() %} +{{ value.path }}: file.managed: - - name: {{ logrotate.include_dir }}/{{ key.split("/")[-1] }} + - name: {{ logrotate.include_dir }}/{{ job_name }} - source: salt://logrotate/templates/job.tmpl - template: jinja - user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }} @@ -19,6 +19,6 @@ include: - watch_in: - service: {{ logrotate.service }} - context: - path: {{ key }} - data: {{ value }} + path: {{ value.path }} + data: {{ value.data }} {%- endfor -%} diff --git a/pillar.example b/pillar.example index 0b35ca2..42bbd23 100644 --- a/pillar.example +++ b/pillar.example @@ -4,12 +4,14 @@ logrotate: pkg: logrotate service: crond jobs: - /tmp/var/log/mysql/error: - - weekly - - missingok - - rotate 52 - - compress - - delaycompress - - notifempty - - create 640 root adm - - sharedscripts + httpd: + path: /var/log/httpd/*log + data: + - weekly + - missingok + - rotate 52 + - compress + - delaycompress + - notifempty + - create 640 root adm + - sharedscripts