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.

28 lines
874B

  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.items() %}
  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. - context:
  18. {% if value is mapping %}
  19. path: {{ value.get('path', []) }}
  20. data: {{ value.get('config', []) }}
  21. {% else %}
  22. path: {{ key }}
  23. data: {{ value }}
  24. {% endif %}
  25. {%- endfor -%}