Following the template-formula example.master
Manages logrotate config and include dir. | Manages logrotate config and include dir. | ||||
``logrotate.install`` | |||||
--------------------- | |||||
Installs the logrotate package and its dependencies. | |||||
``logrotate.jobs`` | ``logrotate.jobs`` | ||||
------------------ | ------------------ | ||||
Create custom job for logrotate. | Create custom job for logrotate. | ||||
``logrotate.service`` | |||||
--------------------- | |||||
Manages the startup and running state of the logrotate service. |
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }} | - user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }} | ||||
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }} | - group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }} | ||||
- mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }} | - mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }} | ||||
- require: | |||||
- pkg: 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 | |||||
{% from "logrotate/map.jinja" import logrotate with context %} | |||||
logrotate: | |||||
pkg.installed: | |||||
- name: {{ logrotate.pkg|json }} | |||||
service.running: | |||||
- name: {{ logrotate.service }} | |||||
- enable: True | |||||
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 | |||||
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
include: | |||||
- logrotate.install | |||||
- logrotate.config | |||||
- logrotate.service |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
{% from "logrotate/map.jinja" import logrotate with context %} | |||||
logrotate-pkg: | |||||
pkg.installed: | |||||
- name: {{ logrotate.pkg }} |
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }} | - group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }} | ||||
- mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }} | - mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }} | ||||
- require: | - require: | ||||
- pkg: logrotate | |||||
- pkg: logrotate-pkg | |||||
- context: | - context: | ||||
{% if value is mapping %} | {% if value is mapping %} | ||||
path: {{ value.get('path', []) }} | path: {{ value.get('path', []) }} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=sls | |||||
{% from "logrotate/map.jinja" import logrotate with context %} | |||||
include: | |||||
- logrotate.config | |||||
- logrotate.install | |||||
logrotate: | |||||
service.running: | |||||
- name: {{ logrotate.service }} | |||||
- enable: True | |||||
- require: | |||||
- pkg: logrotate-pkg | |||||
- file: logrotate_config | |||||
- file: logrotate_directory |