1
0
Fork 0
mirror of synced 2024-12-21 05:31:09 -05:00

Merge pull request #37 from netmanagers/master

Re-add map.jinja changes from #35 lost on #36
This commit is contained in:
Niels Abspoel 2018-11-15 20:13:32 +01:00 committed by GitHub
commit 2db09ef11a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 52 deletions

View file

@ -2,56 +2,24 @@
# vim: ft=jinja # vim: ft=jinja
{% import_yaml 'logrotate/defaults.yaml' as default_settings %} {% 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']({ {% set osfam = salt['grains.filter_by'](
'Arch': { os_family_map,
'service': 'logrotate.timer', grain='os_family',
'default_config': { ) or {} %}
'tabooext': '+ .pacorig .pacnew .pacsave', {% set os = salt['grains.filter_by'](
}, os_map,
}, grain='os',
'Debian': { ) or {} %}
'default_config': {
'compress': True,
},
},
'RedHat': {
'pkg': [
'logrotate',
'cronie'
],
'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 os_map = salt['grains.filter_by']({ {% do salt['defaults.merge'](default_settings['logrotate'], osfam) %}
'Ubuntu': { {% do salt['defaults.merge'](default_settings['logrotate'], os) %}
'default_config': {
'su': 'root syslog' {% set logrotate = salt['pillar.get'](
}, 'logrotate:lookup',
}, default=default_settings['logrotate'],
}, merge=True,
grain="os", ) %}
merge=os_family_map) or {}
%}
{% set logrotate = salt['grains.filter_by'](
default_settings,
merge=os_map,
base='logrotate',
)
%}

View file

@ -6,6 +6,7 @@ Debian:
default_config: default_config:
compress: True compress: True
RedHat: RedHat:
pkg: cronie
service: crond service: crond
default_config: default_config:
dateext: True dateext: True
@ -24,4 +25,4 @@ Gentoo:
FreeBSD: FreeBSD:
conf_file: /usr/local/etc/logrotate.conf conf_file: /usr/local/etc/logrotate.conf
include_dir: /usr/local/etc/logrotate.d include_dir: /usr/local/etc/logrotate.d
group: wheel group: wheel

View file

@ -2,7 +2,13 @@
title 'Test logrotate installation' title 'Test logrotate installation'
describe package('logrotate') do case os[:name]
when 'redhat', 'centos', 'fedora'
pkg = 'cronie'
else
pkg = 'logrotate'
end
describe package(pkg) do
it { should be_installed } it { should be_installed }
end end