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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. include:
  4. - linux.system.user
  5. {%- for name, job in system.job.items() %}
  6. linux_job_{{ job.command }}:
  7. {%- if job.enabled|default(True) %}
  8. cron.present:
  9. - name: >
  10. {{ job.command }}
  11. {%- if job.get('identifier', True) %}
  12. - identifier: {{ job.get('identifier', job.get('name', name)) }}
  13. {%- endif %}
  14. - user: {{ job.user|default("root") }}
  15. {%- if job.minute is defined %}
  16. - minute: '{{ job.minute }}'
  17. {%- endif %}
  18. {%- if job.hour is defined %}
  19. - hour: '{{ job.hour }}'
  20. {%- endif %}
  21. {%- if job.daymonth is defined %}
  22. - daymonth: '{{ job.daymonth }}'
  23. {%- endif %}
  24. {%- if job.month is defined %}
  25. - month: '{{ job.month }}'
  26. {%- endif %}
  27. {%- if job.dayweek is defined %}
  28. - dayweek: '{{ job.dayweek }}'
  29. {%- endif %}
  30. {%- if job.user|default("root") in system.get('user', {}).keys() %}
  31. - require:
  32. - user: system_user_{{ job.user|default("root") }}
  33. {%- endif %}
  34. {%- else %}
  35. cron.absent:
  36. - name: {{ job.command }}
  37. {%- if job.get('identifier', True) %}
  38. - identifier: {{ job.get('identifier', job.get('name', name)) }}
  39. {%- endif %}
  40. {%- endif %}
  41. {%- endfor %}
  42. {%- endif %}