Saltstack Official Logrotate 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.

34 lines
1.0KB

  1. # vim: sts=2 ts=2 sw=2 et ai
  2. {% from "logrotate/map.jinja" import logrotate with context %}
  3. include:
  4. - logrotate
  5. logrotate_directory:
  6. file.directory:
  7. - name: {{ logrotate.include_dir }}
  8. - user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
  9. - group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
  10. - mode: 755
  11. - makedirs: True
  12. - require:
  13. - pkg: logrotate
  14. {% for key,value in logrotate.jobs.iteritems() %}
  15. {{key}}:
  16. file.managed:
  17. - name: {{ logrotate.include_dir }}/{{ key.split("/")[-1] }}
  18. - source: salt://logrotate/templates/job.tmpl
  19. - template: jinja
  20. - user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
  21. - group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
  22. - mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }}
  23. - require:
  24. - pkg: logrotate
  25. - watch_in:
  26. - service: {{ logrotate.service }}
  27. - context:
  28. path: {{ key }}
  29. data: {{ value }}
  30. {%- endfor -%}