2017-07-28 01:43:45 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
2019-08-28 00:21:22 +02:00
|
|
|
{#- 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
|
|
|
|
2019-10-17 22:32:38 +02:00
|
|
|
{%- for task, task_options in cron.get('tasks', {}).items() %}
|
|
|
|
{%- set cron_type = task_options.type|d('present') %}
|
2017-07-28 01:43:45 +02:00
|
|
|
|
|
|
|
cron.{{ task }}:
|
2019-10-17 22:32:38 +02:00
|
|
|
cron.{{ cron_type }}:
|
2019-03-31 01:58:35 +01:00
|
|
|
- name: {{ task_options.name }}
|
2019-10-17 20:27:23 +02:00
|
|
|
- user: {{ task_options.user|d('root') }}
|
2019-10-17 22:32:38 +02:00
|
|
|
- identifier: '{{ task }}'
|
|
|
|
{%- if cron_type == 'present' %}
|
|
|
|
- commented: {{ task_options.commented|d(False) }}
|
|
|
|
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
|
|
|
|
{%- if section in task_options %}
|
|
|
|
- {{ section }}: '{{ task_options[section] }}'
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
2019-03-31 00:10:19 +01:00
|
|
|
{%- endif %}
|
2019-10-17 22:32:38 +02:00
|
|
|
|
|
|
|
{%- endfor %}
|
2019-11-01 08:38:15 +01:00
|
|
|
|
|
|
|
{%- for env, env_options in cron.get('env', {}). items() %}
|
2019-11-03 09:12:03 +01:00
|
|
|
{%- set env_type = env_options.type|d('present') %}
|
2019-11-01 08:38:15 +01:00
|
|
|
|
|
|
|
cron.{{ env }}:
|
|
|
|
cron.env_{{ env_type }}:
|
|
|
|
- name: {{ env_options.name }}
|
|
|
|
{%- if env_type == 'present' %}
|
|
|
|
- value: {{ env_options.value }}
|
|
|
|
{%- endif %}
|
|
|
|
- user: {{ env_options.user|d('root') }}
|
|
|
|
|
|
|
|
{%- endfor %}
|