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.

44 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: {{ job.command }}
  8. {%- if job.get('identifier', True) %}
  9. - identifier: {{ job.get('identifier', job.get('name', name)) }}
  10. {%- endif %}
  11. - user: {{ job.user|default("root") }}
  12. {%- if job.minute is defined %}
  13. - minute: '{{ job.minute }}'
  14. {%- endif %}
  15. {%- if job.hour is defined %}
  16. - hour: '{{ job.hour }}'
  17. {%- endif %}
  18. {%- if job.daymonth is defined %}
  19. - daymonth: '{{ job.daymonth }}'
  20. {%- endif %}
  21. {%- if job.month is defined %}
  22. - month: '{{ job.month }}'
  23. {%- endif %}
  24. {%- if job.dayweek is defined %}
  25. - dayweek: '{{ job.dayweek }}'
  26. {%- endif %}
  27. {%- if job.user|default("root") in system.get('user', {}).keys() %}
  28. - require:
  29. - user: system_user_{{ job.user|default("root") }}
  30. {%- endif %}
  31. {%- else %}
  32. cron.absent:
  33. - name: {{ job.command }}
  34. {%- if job.get('identifier', True) %}
  35. - identifier: {{ job.get('identifier', job.get('name', name)) }}
  36. {%- endif %}
  37. {%- endif %}
  38. {%- endfor %}
  39. {%- endif %}