Saltstack Official Logrotate Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

52 行
1.5KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=jinja
  3. {#- Get the `tplroot` from `tpldir` #}
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {#- Start imports as #}
  6. {%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
  7. {%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
  8. {%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
  9. {%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
  10. {#- Retrieve the config dict only once #}
  11. {%- set _config = salt['config.get'](tplroot, default={}) %}
  12. {%- set defaults = salt['grains.filter_by'](
  13. default_settings,
  14. default=tplroot,
  15. merge=salt['grains.filter_by'](
  16. osfamilymap,
  17. grain='os_family',
  18. merge=salt['grains.filter_by'](
  19. osmap,
  20. grain='os',
  21. merge=salt['grains.filter_by'](
  22. osfingermap,
  23. grain='osfinger',
  24. merge=salt['grains.filter_by'](
  25. _config,
  26. default='lookup'
  27. )
  28. )
  29. )
  30. )
  31. )
  32. %}
  33. {%- set config = salt['grains.filter_by'](
  34. {'defaults': defaults},
  35. default='defaults',
  36. merge=_config
  37. )
  38. %}
  39. {#- Change **logrotate** to match with your formula's name and then remove this line #}
  40. {%- set logrotate = config %}
  41. {#- Post-processing for specific non-YAML customisations #}
  42. {%- if grains.os == 'MacOS' %}
  43. {%- set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
  44. {%- do logrotate.update({'rootgroup': macos_group}) %}
  45. {%- endif %}