diff --git a/manifests/init.pp b/manifests/init.pp index 36a5157..8649656 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,6 +5,9 @@ $httpd_address = $monit::params::httpd_address, $httpd_user = $monit::params::httpd_user, $httpd_password = $monit::params::httpd_password, + $httpd_htpasswd_file = $monit::params::httpd_htpasswd_file, + $httpd_htpasswd_crypto = $monit::params::httpd_htpasswd_crypto, + $httpd_htpasswd_users = $monit::params::httpd_htpasswd_users, $manage_firewall = $monit::params::manage_firewall, $package_ensure = $monit::params::package_ensure, $package_name = $monit::params::package_name, @@ -35,6 +38,9 @@ validate_string($httpd_address) validate_string($httpd_user) validate_string($httpd_password) + validate_string($httpd_htpasswd_file) + validate_string($httpd_htpasswd_crypto) + validate_array($httpd_htpasswd_users) validate_bool($manage_firewall) validate_string($package_ensure) validate_string($package_name) diff --git a/manifests/params.pp b/manifests/params.pp index 8027b7d..f599814 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,6 +8,9 @@ $httpd_address = 'localhost' $httpd_user = 'admin' $httpd_password = 'monit' + $httpd_htpasswd_file = '' + $httpd_htpasswd_crypto = 'md5' + $httpd_htpasswd_users = [] $manage_firewall = false $package_ensure = 'present' $package_name = 'monit' diff --git a/templates/monitrc.erb b/templates/monitrc.erb index 5425aab..b045f39 100644 --- a/templates/monitrc.erb +++ b/templates/monitrc.erb @@ -32,6 +32,9 @@ set httpd port <%= @httpd_port %> and <%- if !@httpd_user.empty? && !@httpd_password.empty? -%> allow <%= @httpd_user %>:<%= @httpd_password %> <%- end -%> + <%- if !@httpd_htpasswd_crypto.empty? && !@httpd_htpasswd_file.empty? -%> + allow <%= @httpd_htpasswd_crypto %> <%= @httpd_htpasswd_file %> <%= @httpd_htpasswd_users.join(' ') %> + <%- end -%> <%- end -%> <%- if @mmonit_address -%> set mmonit http://<%= @mmonit_user %>:<%= @mmonit_password %>@<%= @mmonit_address %>:<%= @mmonit_port %>/collector