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

48 lines
1.2KB

  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 %}