mirror of
https://github.com/saltstack-formulas/cron-formula.git
synced 2026-10-24 14:25:06 +02:00
refactor(config): minimise and standardise between .sls & .tst
This commit is contained in:
3 files changed
+38
-101
No files matched your search
+13
-15
@@ -5,23 +5,21 @@
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import cron with context %}
|
||||
|
||||
{%- if 'tasks' in cron %}
|
||||
{%- for task, task_options in cron.tasks.items() %}
|
||||
{%- for task, task_options in cron.get('tasks', {}).items() %}
|
||||
{%- set cron_type = task_options.type|d('present') %}
|
||||
|
||||
cron.{{ task }}:
|
||||
cron.{{ task_options.type|d('present') }}:
|
||||
cron.{{ cron_type }}:
|
||||
- name: {{ task_options.name }}
|
||||
- identifier: '{{ task }}'
|
||||
{%- if 'user' in task_options %}
|
||||
- user: {{ task_options.user|d('root') }}
|
||||
- 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 %}
|
||||
{%- endif %}
|
||||
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
|
||||
{%- if section in task_options %}
|
||||
- {{ section }}: '{{ task_options.get(section) }}'
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if task_options.commented|d(False) %}
|
||||
- commented: True
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
{%- endfor %}
|
||||
Reference in new issue
Block a user