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.

45 lines
1.2KB

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