0
0
mirror of https://github.com/saltstack-formulas/cron-formula.git synced 2024-11-28 07:47:50 +01:00
cron-formula/cron/config/file.sls

39 lines
1.1 KiB
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
{%- 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 }}:
cron.{{ cron_type }}:
- name: {{ task_options.name }}
- 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 %}
{%- endfor %}
{%- for env, env_options in cron.get('env', {}). items() %}
{%- set env_type = env_options.type|d('present') %}
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 %}