mirror of
https://github.com/saltstack-formulas/cron-formula.git
synced 2024-11-28 03:27:50 +01:00
refactor(config): remove duplication in using a loop
This commit is contained in:
parent
72281c7905
commit
652ebff734
@ -11,34 +11,17 @@
|
|||||||
cron.{{ task }}:
|
cron.{{ task }}:
|
||||||
cron.{{ task_options.type|default('present') }}:
|
cron.{{ task_options.type|default('present') }}:
|
||||||
- name: {{ task_options.name }}
|
- name: {{ task_options.name }}
|
||||||
|
- identifier: '{{ task }}'
|
||||||
{%- if 'user' in task_options %}
|
{%- if 'user' in task_options %}
|
||||||
- user: {{ task_options.user|default('root') }}
|
- user: {{ task_options.user|default('root') }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if 'minute' in task_options %}
|
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
|
||||||
- minute: '{{ task_options.minute }}'
|
{%- if section in task_options %}
|
||||||
{%- endif %}
|
- {{ section }}: '{{ task_options.get(section) }}'
|
||||||
{%- if 'hour' in task_options %}
|
|
||||||
- hour: '{{ task_options.hour }}'
|
|
||||||
{%- endif %}
|
|
||||||
{%- if 'daymonth' in task_options %}
|
|
||||||
- daymonth: '{{ task_options.daymonth }}'
|
|
||||||
{%- endif %}
|
|
||||||
{%- if 'month' in task_options %}
|
|
||||||
- month: '{{ task_options.month }}'
|
|
||||||
{%- endif %}
|
|
||||||
{%- if 'dayweek' in task_options %}
|
|
||||||
- dayweek: '{{ task_options.dayweek }}'
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
{%- if 'commented' in task_options and task_options.commented %}
|
{%- if 'commented' in task_options and task_options.commented %}
|
||||||
- commented: True
|
- commented: True
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if 'special' in task_options %}
|
|
||||||
- special: '{{ task_options.special }}'
|
|
||||||
{%- endif %}
|
|
||||||
- identifier: '{{ task }}'
|
|
||||||
{%- if 'comment' in task_options %}
|
|
||||||
- comment: {{ task_options.comment }}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user