0
0
mirror of https://github.com/saltstack-formulas/cron-formula.git synced 2024-12-11 08:25:57 +01:00
cron-formula/cron/config/file.sls

28 lines
871 B
Plaintext
Raw Normal View History

2017-07-28 01:43:45 +02:00
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import cron with context %}
2017-07-28 01:43:45 +02:00
{%- if 'tasks' in cron %}
{%- for task, task_options in cron.tasks.items() %}
2017-07-28 01:43:45 +02:00
cron.{{ task }}:
cron.{{ task_options.type|default('present') }}:
- name: {{ task_options.name }}
- identifier: '{{ task }}'
{%- if 'user' in task_options %}
- user: {{ task_options.user|default('root') }}
{%- endif %}
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
{%- if section in task_options %}
- {{ section }}: '{{ task_options.get(section) }}'
{%- endif %}
{%- endfor %}
{%- if 'commented' in task_options and task_options.commented %}
- commented: True
{%- endif %}
{%- endfor %}
{%- endif %}