added logrotate state
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Paul 2024-07-06 08:59:01 +02:00
parent ccdd304d53
commit 3cc7f89544
8 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,13 @@
---
{%- from "logrotate/map.jinja" import logrotate with context %}
{%- for filename, cfg in logrotate.config.items() %}
logrotate-config-{{ filename }}:
file.managed:
- name: /etc/logrotate.d/{{ filename }}
- source: salt://logrotate/templates/config.j2
- user: root
- group: root
- template: jinja
- context:
cfg: {{ cfg }}
{%- endfor %}

View File

@ -0,0 +1,15 @@
---
logrotate:
config:
salt:
files:
- /var/log/salt/master
- /var/log/salt/minion
options:
- daily
- rotate 6
- compress
- delaycompress
- missingok
- notifempty
- create 0640 root root

View File

@ -0,0 +1,4 @@
---
include:
- .install
- .config

View File

@ -0,0 +1,5 @@
---
{%- from "logrotate/map.jinja" import logrotate with context %}
logrotate-pkg:
pkg.installed:
- pkgs: logrotate

View File

@ -0,0 +1,3 @@
---
Linux:
os: "linux"

View File

@ -0,0 +1,14 @@
{%- import_yaml "logrotate/defaults.yaml" as default_settings -%}
{%- import_yaml "logrotate/kernelmap.yaml" as kernelmap -%}
{%- import_yaml "logrotate/osarchmap.yaml" as osarchmap -%}
{%- set defaults = salt['grains.filter_by'](default_settings,
default='logrotate',
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
)
)
-%}
{%- set logrotate = salt['pillar.get']('logrotate', default=defaults, merge=True) -%}

View File

@ -0,0 +1,24 @@
---
amd64:
arch: "amd64"
x86_64:
arch: "amd64"
386:
arch: "386"
arm64:
arch: "arm64"
aarch64:
arch: "arm64"
armv6l:
arch: "armv6"
armv7l:
arch: "armv7"
armhf:
arch: "armv7"

View File

@ -0,0 +1,10 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "logrotate/map.jinja" import logrotate with context -%}
{%- for file in cfg.files %}
{{ file }}
{%- endfor %}
{
{%- for option in cfg.options %}
{{ option }}
{%- endfor %}
}