From 4f12852e429577fbe423bfad866e6a4ceae75d77 Mon Sep 17 00:00:00 2001 From: Anirudh Aekawadi Date: Thu, 27 Aug 2020 18:55:11 -0700 Subject: [PATCH] Add ability to configure errorlog file path and mode --- manifests/init.pp | 20 +++++++++++++++++++- manifests/install.pp | 10 ++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 75cda41c..afac6550 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,6 +24,18 @@ # * `datadir_mode` # The filesystem mode for the `datadir`. Defaults to '0600' # +# * `errorlog_file` +# The File where ProxySQL will store its error logs. Defaults to '/var/lib/proxysql/proxysql.log'. Available from ProxySQL v2.0.0 +# +# * `errorlog_file_mode` +# The filesystem mode for the `errorlog_file_mode`. Defaults to '0600'. Available from ProxySQL v2.0.0 +# +# * `errorlog_file_owner` +# Owner of the `errorlog_file`. Defaults to 'proxysql'. Available from ProxySQL v2.0.0 +# +# * `errorlog_file_group` +# Group of the `errorlog_file`. Defaults to 'proxysql'. Available from ProxySQL v2.0.0 +# # * `manage_selinux` # Whether to create the required selinux rules for logrotate to work. Defaults to `true`, but is only applicable to systems where SELinux is active (`enforcing` or `permissive`). # This parameter also requires the `puppet/selinux` module to be installed. @@ -182,6 +194,11 @@ Boolean $manage_selinux = true, Boolean $manage_mysql_client = true, + Optional[Stdlib::Unixpath] $errorlog_file = undef, + Stdlib::Filemode $errorlog_file_mode = '0600', + String $errorlog_file_owner = 'proxysql', + String $errorlog_file_group = 'proxysql', + String $listen_ip = $proxysql::params::listen_ip, Integer $listen_port = $proxysql::params::listen_port, String $listen_socket = $proxysql::params::listen_socket, @@ -246,6 +263,7 @@ ) inherits proxysql::params { $default_settings = { datadir => $datadir, + errorlog => $errorlog_file, admin_variables => { admin_credentials => "${admin_username}:${admin_password.unwrap}", mysql_ifaces => "${admin_listen_ip}:${admin_listen_port};${admin_listen_socket}", @@ -263,7 +281,7 @@ mysql_replication_hostgroups => {}, mysql_group_replication_hostgroups => {}, mysql_galera_hostgroups => {}, - } + }.filter |$key, $val| { $val =~ NotUndef } $cluster_settings = $cluster_name ? { String => { diff --git a/manifests/install.pp b/manifests/install.pp index f0104a2f..822a2f37 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -44,6 +44,16 @@ mode => $proxysql::datadir_mode, } + if $proxysql::errorlog_file { + file { $proxysql::errorlog_file: + ensure => file, + path => $proxysql::errorlog_file, + owner => $proxysql::errorlog_file_owner, + group => $proxysql::errorlog_file_group, + mode => $proxysql::errorlog_file_mode, + } + } + if $proxysql::manage_mysql_client { class { 'mysql::client': package_name => $proxysql::mysql_client_package_name,