Browse Source

Merge pull request #12 from fortune-juggle/fix/5

fixes issue #5
master
Nitin Madhok 9 years ago
parent
commit
d6ce3cd1bc
3 changed files with 29 additions and 12 deletions
  1. +2
    -2
      logrotate/init.sls
  2. +6
    -1
      logrotate/jobs.sls
  3. +21
    -9
      pillar.example

+ 2
- 2
logrotate/init.sls View File

logrotate_directory: logrotate_directory:
file.directory: file.directory:
- name: {{ logrotate.include_dir }} - name: {{ logrotate.include_dir }}
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
- mode: 755 - mode: 755
- makedirs: True - makedirs: True
- require: - require:

+ 6
- 1
logrotate/jobs.sls View File

- logrotate - logrotate


{% for key,value in jobs.iteritems() %} {% for key,value in jobs.iteritems() %}
{{key}}:
logrotate_{{key}}:
file.managed: file.managed:
- name: {{ logrotate.include_dir }}/{{ key.split("/")[-1] }} - name: {{ logrotate.include_dir }}/{{ key.split("/")[-1] }}
- source: salt://logrotate/templates/job.tmpl - source: salt://logrotate/templates/job.tmpl
- watch_in: - watch_in:
- service: {{ logrotate.service }} - service: {{ logrotate.service }}
- context: - context:
{% if value is mapping %}
path: {{ value.get('path', key) }}
data: {{ value.get('config', []) }}
{% else %}
path: {{ key }} path: {{ key }}
data: {{ value }} data: {{ value }}
{% endif %}
{%- endfor -%} {%- endfor -%}

+ 21
- 9
pillar.example View File

pkg: logrotate pkg: logrotate
service: crond service: crond
jobs: jobs:
/tmp/var/log/mysql/error:
- weekly
- missingok
- rotate 52
- compress
- delaycompress
- notifempty
- create 640 root adm
- sharedscripts
/tmp/var/log/mysql/error:
config:
- weekly
- missingok
- rotate 52
- compress
- delaycompress
- notifempty
- create 640 root adm
- sharedscripts
mysql:
path: /tmp/var/log/mysql/*.log
config:
- weekly
- missingok
- rotate 52
- compress
- delaycompress
- notifempty
- create 640 root adm
- sharedscripts

Loading…
Cancel
Save