From 2ff86053578a4761b897b8349edb725f4576e430 Mon Sep 17 00:00:00 2001 From: Ben Formosa Date: Thu, 27 Feb 2020 11:17:33 +1100 Subject: [PATCH] Add configuration for file and dir modes --- README.md | 8 +++++++- defaults/main.yml | 6 ++++++ templates/rsyslog.conf.j2 | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 364b69c..afd123c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Install and configure rsyslog on your system. |Travis|GitHub|Quality|Downloads| |------|------|-------|---------| -|[![travis](https://travis-ci.org/robertdebock/ansible-role-rsyslog.svg?branch=master)](https://travis-ci.org/robertdebock/ansible-role-rsyslog)|[![github](https://github.com/robertdebock/ansible-role-rsyslog/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-rsyslog/actions)|![quality](https://img.shields.io/ansible/quality/22988)|![downloads](https://img.shields.io/ansible/role/d/22988)| +|[![travis](https://travis-ci.org/robertdebock/ansible-role-rsyslog.svg?branch=master)](https://travis-ci.org/robertdebock/ansible-role-rsyslog)|[![github](https://github.com/robertdebock/ansible-role-rsyslog/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-rsyslog/actions)|![quality](https://img.shields.io/ansible/quality/)|![downloads](https://img.shields.io/ansible/role/d/)| Example Playbook ---------------- @@ -65,6 +65,12 @@ These variables are set in `defaults/main.yml`: # the ipaddress of the receiving rsyslog server. # Not setting this variable will not forward logs. # rsyslog_remote: server1.example.com + +# Set the mode for new directories +rsyslog_dircreatemode: "0700" + +# Set the mode for new files +rsyslog_filecreatemode: "0644" ``` Requirements diff --git a/defaults/main.yml b/defaults/main.yml index e271305..1d9d06a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,3 +9,9 @@ # the ipaddress of the receiving rsyslog server. # Not setting this variable will not forward logs. # rsyslog_remote: server1.example.com + +# Set the mode for new directories +rsyslog_dircreatemode: "0700" + +# Set the mode for new files +rsyslog_filecreatemode: "0644" diff --git a/templates/rsyslog.conf.j2 b/templates/rsyslog.conf.j2 index 8c69868..d1bb9d8 100644 --- a/templates/rsyslog.conf.j2 +++ b/templates/rsyslog.conf.j2 @@ -52,6 +52,9 @@ $OmitLocalLogging on # File to store the position in the journal $IMJournalStateFile imjournal.state +# Set mode for new files and directories +$DirCreateMode {{ rsyslog_dircreatemode }} +$FileCreateMode {{ rsyslog_filecreatemode }} #### RULES ####