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.

30 lines
932B

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