From 4278bca7abde3c64f5b7f325b77cbef399e14a4c Mon Sep 17 00:00:00 2001 From: Pascal Liehne Date: Fri, 30 Mar 2018 00:46:00 +0200 Subject: [PATCH 1/2] use user and group from pillar or map for logrotate --- bind/files/debian/logrotate_bind | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bind/files/debian/logrotate_bind b/bind/files/debian/logrotate_bind index cbc1417..a5c6d88 100644 --- a/bind/files/debian/logrotate_bind +++ b/bind/files/debian/logrotate_bind @@ -1,3 +1,6 @@ +{%- from "bind/map.jinja" import map with context %} +{%- set user = salt['pillar.get']('bind:config:user', map.user) %} +{%- set group = salt['pillar.get']('bind:config:group', map.group) %} {{ map.log_dir }}/query.log { rotate 7 daily @@ -6,8 +9,8 @@ sharedscripts copytruncate compress - create 0664 bind root + create 0664 {{ user }} {{ group }} {% if not salt['pkg.version']('logrotate').startswith('3.7')-%} - su + su {{ user }} {{ group }} {% endif %} } From 2c8de7bf24de4f9ecec1160c2ea93759079baebd Mon Sep 17 00:00:00 2001 From: Pascal Liehne Date: Fri, 30 Mar 2018 00:53:20 +0200 Subject: [PATCH 2/2] use file mode from pillar or map for logrotate --- bind/files/debian/logrotate_bind | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bind/files/debian/logrotate_bind b/bind/files/debian/logrotate_bind index a5c6d88..9b90f22 100644 --- a/bind/files/debian/logrotate_bind +++ b/bind/files/debian/logrotate_bind @@ -1,6 +1,7 @@ {%- from "bind/map.jinja" import map with context %} {%- set user = salt['pillar.get']('bind:config:user', map.user) %} {%- set group = salt['pillar.get']('bind:config:group', map.group) %} +{%- set mode = salt['pillar.get']('bind:config:log_mode', map.log_mode) %} {{ map.log_dir }}/query.log { rotate 7 daily @@ -9,7 +10,7 @@ sharedscripts copytruncate compress - create 0664 {{ user }} {{ group }} + create {{ mode }} {{ user }} {{ group }} {% if not salt['pkg.version']('logrotate').startswith('3.7')-%} su {{ user }} {{ group }} {% endif %}