diff --git a/manifests/server.pp b/manifests/server.pp index 22afec5..ae719c8 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -15,12 +15,17 @@ # == Class: mosquitto # class mosquitto::server ( - + $pid_file = '/var/run/mosquitto.pid', + $log_file = '/var/log/mosquitto/mosquitto.log', + $persistence_location = '/var/lib/mosquitto/', ) { -file {'/etc/mosquitto/mosquitto.conf': - ensure => present, - content => template('mosquitto/mosquitto.conf.erb'), -} - + file {'/etc/mosquitto/mosquitto.conf': + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + content => template('mosquitto/mosquitto.conf.erb'), + require => Package['mosquitto'], + } } diff --git a/templates/mosquitto.conf.erb b/templates/mosquitto.conf.erb index f0e1402..0112aff 100644 --- a/templates/mosquitto.conf.erb +++ b/templates/mosquitto.conf.erb @@ -32,7 +32,7 @@ # This should be set to /var/run/mosquitto.pid if mosquitto is # being run automatically on boot with an init script and # start-stop-daemon or similar. -#pid_file +pid_file <%= @pid_file %> # When run as root, drop privileges to this user and its primary # group. @@ -422,17 +422,18 @@ # subscriptions, currently in-flight messages and retained # messages. # retained_persistence is a synonym for this option. -#persistence false +persistence true # The filename to use for the persistent database, not including # the path. -#persistence_file mosquitto.db +#persistence_file # Location for persistent database. Must include trailing / # Default is an empty string (current directory). # Set to e.g. /var/lib/mosquitto/ if running as a proper service on Linux or # similar. -#persistence_location +persistence_location <%= @persistence_location %> + # ================================================================= # Logging @@ -463,6 +464,8 @@ # Use "log_dest none" if you wish to disable logging. #log_dest stderr +log_dest file <%= @log_file %> + # If using syslog logging (not on Windows), messages will be logged to the # "daemon" facility by default. Use the log_facility option to choose which of # local0 to local7 to log to instead. The option value should be an integer @@ -809,7 +812,7 @@ # in the main file. This option will only be processed from the main # configuration file. The directory specified must not contain the # main configuration file. -#include_dir +include_dir /etc/mosquitto/conf.d # ================================================================= # rsmb options - unlikely to ever be supported