1
0
Fork 0
mirror of synced 2024-11-17 14:35:34 -05:00

add support jobs

This commit is contained in:
root 2015-01-21 18:00:07 +08:00
parent bcd4aed71c
commit cfc24f6ead
4 changed files with 47 additions and 5 deletions

33
logrotate/jobs.sls Normal file
View file

@ -0,0 +1,33 @@
# vim: sts=2 ts=2 sw=2 et ai
{% from "logrotate/map.jinja" import logrotate with context %}
include:
- logrotate
logrotate_directory:
file.directory:
- name: {{ logrotate.include_dir }}
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
- mode: 755
- makedirs: True
- require:
- pkg: logrotate
{% for key,value in logrotate.jobs.iteritems() %}
{{key}}:
file.managed:
- name: {{ logrotate.include_dir }}/{{ key.split("/")[-1] }}
- source: salt://logrotate/templates/job.tmpl
- template: jinja
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
- mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }}
- require:
- pkg: logrotate
- watch_in:
- service: {{ logrotate.service }}
- context:
path: {{ key }}
data: {{ value }}
{%- endfor -%}

View file

@ -23,4 +23,4 @@
'user' : 'root',
'group' : 'root',
},
}, merge=salt['pillar.get']('logrotate:lookup')) %}
}, merge=salt['pillar.get']('logrotate')) %}

View file

@ -0,0 +1,6 @@
# vim: sw=2 sts=2 ts=2 sw et
{{ path }} {
{% for item in data %}
{{ item }}
{%- endfor %}
}

View file

@ -1,5 +1,8 @@
# vim: sts=2 ts=2 sw=2 et ai
logrotate:
lookup:
pkg: 'logrotate'
service: 'crond'
pkg: 'logrotate'
service: 'crond'
jobs:
"/home/www/billing.irknet.ru/logs/mysql_logs":
- "mounthly"
- "month"