Quellcode durchsuchen

Merge pull request #2 from fessoga5/master

add support jobs
tags/v0.9.0
Nitin Madhok vor 10 Jahren
Ursprung
Commit
c267fb69b0
3 geänderte Dateien mit 53 neuen und 4 gelöschten Zeilen
  1. +34
    -0
      logrotate/jobs.sls
  2. +6
    -0
      logrotate/templates/job.tmpl
  3. +13
    -4
      pillar.example

+ 34
- 0
logrotate/jobs.sls Datei anzeigen

@@ -0,0 +1,34 @@
# vim: sts=2 ts=2 sw=2 et ai
{% from "logrotate/map.jinja" import logrotate with context %}
{% set jobs = salt['pillar.get']('logrotate:jobs') %}

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 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 -%}

+ 6
- 0
logrotate/templates/job.tmpl Datei anzeigen

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

+ 13
- 4
pillar.example Datei anzeigen

@@ -1,5 +1,14 @@
# vim: sts=2 ts=2 sw=2 et ai
logrotate:

lookup:
pkg: 'logrotate'
service: 'crond'
pkg: 'logrotate'
service: 'crond'
jobs:
"/tmp/var/log/mysql/error":
- "weekly"
- "missingok"
- "rotate 52"
- "compress"
- "delaycompress"
- "notifempty"
- "create 640 root adm"
- "sharedscripts"

Laden…
Abbrechen
Speichern