Initial commit

This commit is contained in:
David Seira
2017-07-28 01:43:45 +02:00
commit c6c2a1dfd8
7 changed files with 157 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "cron/map.jinja" import cron_settings with context %}
{% if 'tasks' in cron_settings %}
{% for task,task_options in cron_settings.tasks.iteritems() %}
cron.{{ task }}:
cron.{{ task_options.type|default('present') }}:
- name: '{{ task_options.name }}'
{% if 'user' in task_options %}
- user: {{ task_options.user|default('root') }}
{% endif %}
{% if 'minute' in task_options %}
- minute: {{ task_options.minute }}
{% endif %}
{% if 'hour' in task_options %}
- hour: {{ task_options.hour }}
{% endif %}
{% if 'daymonth' in task_options %}
- daymonth: {{ task_options.daymonth }}
{% endif %}
{% if 'dayweek' in task_options %}
- dayweek: {{ task_options.dayweek }}
{% endif %}
{% if 'commented' in task_options and task_options.commented %}
- commented: True
{% endif %}
{% if 'special' in task_options %}
- special: '{{ task_options.special }}'
{% endif %}
- identifier: '{{ task }}'
{% if 'comment' in task_options %}
- comment: '{{ task_options.comment }}'
{% endif %}
{% endfor %}
{% endif %}
+7
View File
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
include:
- cron.install
- cron.config
- cron.service
+8
View File
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "cron/map.jinja" import cron_settings with context %}
cron.install:
pkg.installed:
- name: {{ cron_settings.pkg }}
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# vim: ft=jinja
{% set os_family_map = salt['grains.filter_by']({
'RedHat': {
'pkg': 'cronie',
'service': 'crond',
},
'Debian': {
'pkg': 'cron',
'service': 'cron',
},
}, grain='os_family', merge=salt['pillar.get']('cron:lookup')) %}
{% set cron_settings = salt['pillar.get'](
'cron',
default=os_family_map,
merge=True
)
%}
+15
View File
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "cron/map.jinja" import cron_settings with context %}
cron.service:
{% if 'enabled' not in cron_settings or ( 'enabled' in cron_settings and cron_settings.enabled ) %}
service.running:
- name: {{ cron_settings.service }}
- enable: True
{% else %}
service.dead:
- name: {{ cron_settings.service }}
- enable: False
{% endif %}