Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add httpd_allow and include directive configuration #28

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$httpd_address = $monit::params::httpd_address,
$httpd_user = $monit::params::httpd_user,
$httpd_password = $monit::params::httpd_password,
$httpd_allow = $monit::params::httpd_allow,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you name the variable httpd_networks please?

$manage_firewall = $monit::params::manage_firewall,
$package_ensure = $monit::params::package_ensure,
$package_name = $monit::params::package_name,
Expand All @@ -17,6 +18,7 @@
$config_file = $monit::params::config_file,
$config_dir = $monit::params::config_dir,
$config_dir_purge = $monit::params::config_dir_purge,
$config_include = $monit::params::config_include,
$logfile = $monit::params::logfile,
$mailserver = $monit::params::mailserver,
$mailformat = $monit::params::mailformat,
Expand Down Expand Up @@ -73,6 +75,7 @@
validate_string($httpd_address)
validate_string($httpd_user)
validate_string($httpd_password)
validate_string($httpd_allow)
validate_bool($manage_firewall_bool)
validate_string($package_ensure)
validate_string($package_name)
Expand Down Expand Up @@ -106,6 +109,7 @@
validate_bool($mmonit_without_credential_bool)
validate_absolute_path($config_file)
validate_absolute_path($config_dir)
validate_array($config_include)
validate_bool($config_dir_purge_bool)
# </variable validations>

Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
class monit::params {
$check_interval = 120
$config_dir_purge = false
$config_include = []
$httpd = false
$httpd_port = 2812
$httpd_address = 'localhost'
$httpd_user = 'admin'
$httpd_password = 'monit'
$httpd_allow = '0.0.0.0/0.0.0.0'
$manage_firewall = false
$package_ensure = 'present'
$package_name = 'monit'
Expand Down
5 changes: 4 additions & 1 deletion templates/monitrc.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set eventqueue
<%- if @httpd == true -%>
set httpd port <%= @httpd_port %> and
use address <%= @httpd_address %>
allow 0.0.0.0/0.0.0.0
allow <%= @httpd_allow %>
<%- if !@httpd_user.empty? && !@httpd_password.empty? -%>
allow <%= @httpd_user %>:<%= @httpd_password %>
<%- end -%>
Expand All @@ -37,5 +37,8 @@ set httpd port <%= @httpd_port %> and
set mmonit http://<%= @mmonit_user %>:<%= @mmonit_password %>@<%= @mmonit_address %>:<%= @mmonit_port %>/collector
<%- if @mmonit_without_credential_bool -%> and register without credentials<%- end -%>
<%- end -%>
<%- @config_include.each do |include| -%>
include <%= include %>
<%- end -%>

include <%= @config_dir -%>/*