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.

38 lines
919B

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