Move os_family and os mapping to yaml files
- Add Gentoo support - Add FreeBSD support
This commit is contained in:
parent
6575a95764
commit
db3629904c
3 changed files with 47 additions and 46 deletions
|
@ -2,52 +2,23 @@
|
|||
# vim: ft=jinja
|
||||
|
||||
{% import_yaml 'logrotate/defaults.yaml' as default_settings %}
|
||||
{% import_yaml "logrotate/osfamilymap.yaml" as os_family_map %}
|
||||
{% import_yaml "logrotate/osmap.yaml" as os_map %}
|
||||
|
||||
{% set os_family_map = salt['grains.filter_by']({
|
||||
'Arch': {
|
||||
'service': 'logrotate.timer',
|
||||
'default_config': {
|
||||
'tabooext': '+ .pacorig .pacnew .pacsave',
|
||||
},
|
||||
},
|
||||
'Debian': {
|
||||
'default_config': {
|
||||
'compress': True,
|
||||
},
|
||||
},
|
||||
'RedHat': {
|
||||
'service': 'crond',
|
||||
'default_config': {
|
||||
'dateext': True,
|
||||
},
|
||||
},
|
||||
'Suse': {
|
||||
'login_records_jobs': False,
|
||||
'default_config': {
|
||||
'dateext': True,
|
||||
'compresscmd': '/usr/bin/xz',
|
||||
'uncompresscmd': '/usr/bin/xzdec',
|
||||
},
|
||||
},
|
||||
},
|
||||
grain="os_family",
|
||||
merge=salt['pillar.get']('logrotate:lookup')) or {}
|
||||
%}
|
||||
{% set osfam = salt['grains.filter_by'](
|
||||
os_family_map,
|
||||
grain='os_family',
|
||||
) or {} %}
|
||||
{% set os = salt['grains.filter_by'](
|
||||
os_map,
|
||||
grain='os',
|
||||
) or {} %}
|
||||
|
||||
{% set os_map = salt['grains.filter_by']({
|
||||
'Ubuntu': {
|
||||
'default_config': {
|
||||
'su': 'root syslog'
|
||||
},
|
||||
},
|
||||
},
|
||||
grain="os",
|
||||
merge=os_family_map) or {}
|
||||
%}
|
||||
{% do salt['defaults.merge'](default_settings['logrotate'], osfam) %}
|
||||
{% do salt['defaults.merge'](default_settings['logrotate'], os) %}
|
||||
|
||||
{% set logrotate = salt['grains.filter_by'](
|
||||
default_settings,
|
||||
merge=os_map,
|
||||
base='logrotate',
|
||||
)
|
||||
%}
|
||||
{% set logrotate = salt['pillar.get'](
|
||||
'logrotate:lookup',
|
||||
default=default_settings['logrotate'],
|
||||
merge=True,
|
||||
) %}
|
||||
|
|
27
logrotate/osfamilymap.yaml
Normal file
27
logrotate/osfamilymap.yaml
Normal file
|
@ -0,0 +1,27 @@
|
|||
Arch:
|
||||
service: logrotate.timer
|
||||
default_config:
|
||||
tabooext: + .pacorig .pacnew .pacsave
|
||||
Debian:
|
||||
default_config:
|
||||
compress: True
|
||||
RedHat:
|
||||
service: crond
|
||||
default_config:
|
||||
dateext: True
|
||||
Suse:
|
||||
login_records_jobs: False
|
||||
default_config:
|
||||
dateext: True
|
||||
compresscmd: /usr/bin/xz
|
||||
uncompresscmd: /usr/bin/xzdec
|
||||
Gentoo:
|
||||
pkg: app-admin/logrotate
|
||||
service: cronie
|
||||
default_config:
|
||||
tabooext: + .keep
|
||||
dateext: True
|
||||
FreeBSD:
|
||||
conf_file: /usr/local/etc/logrotate.conf
|
||||
include_dir: /usr/local/etc/logrotate.d
|
||||
group: wheel
|
3
logrotate/osmap.yaml
Normal file
3
logrotate/osmap.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
Ubuntu:
|
||||
default_config:
|
||||
su: root syslog
|
Loading…
Reference in a new issue