diff --git a/README.md b/README.md index 65c2dd35e8..ad97e94dc3 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Installs and manages the open source monitoring framework [Sensu](http://sensuap ## Sensu version supported -The module currently supports Sensu version 0.12 and later. If not explictly stated it should always -support the latest Sensu release. Please log an issue if you identify any incompatibilties. +The module currently supports Sensu version 0.12 and later. If not explicitly stated it should always +support the latest Sensu release. Please log an issue if you identify any incompatibilities. ## Upgrade note @@ -54,36 +54,37 @@ Debian & Ubuntu: ## Quick start -Before this puppet module can be used, the following items must be configured on the server. +Before this Puppet module can be used, the following items must be configured on the server. -- Install redis -- Install rabbitmq -- Add users to rabbitmq +- Install Redis +- Install RabbitMQ +- Add users to RabbitMQ - Install dashboard (optional) -To quickly try out sensu, spin up a test VM with Vagrant that already has these prerequisites installed. +To quickly try out Sensu, spin up a test virtual machine with Vagrant that already has these prerequisites installed. - vagrant up - vagrant status - vagrant ssh sensu-server + $ vagrant up + $ vagrant status + $ vagrant ssh sensu-server -You can then access the api - - curl http://admin:secret@localhost:4567/info +You can then access the API. + $ curl http://admin:secret@localhost:4567/info Navigate to `192.168.56.10:3000` to use the uchiwa dashboard username => uchiwa password => uchiwa -Navigate to `192.168.56.10:15672` to manage rabbitmq +Navigate to `192.168.56.10:15672` to manage RabbitMQ username => sensu password => correct-horse-battery-staple -See the [tests directory](https://github.com/sensu/sensu-puppet/tree/vagrant/tests) and [Vagrantfile](https://github.com/sensu/sensu-puppet/blob/vagrant/Vagrantfile) for examples on setting up the prerequisites. - +See the [tests +directory](https://github.com/sensu/sensu-puppet/tree/vagrant/tests) and +[Vagrantfile](https://github.com/sensu/sensu-puppet/blob/vagrant/Vagrantfile) +for examples on setting up the prerequisites. ## Basic example @@ -382,8 +383,8 @@ apache/manifests/service.pp ## Installing Gems into the embedded ruby -If you are using the embedded ruby that ships with sensu, you can install gems -by using the `sensu_gem` package provier: +If you are using the embedded ruby that ships with Sensu, you can install gems +by using the `sensu_gem` package provider: package { 'redphone': ensure => 'installed', diff --git a/lib/puppet/provider/sensu_redis_config/json.rb b/lib/puppet/provider/sensu_redis_config/json.rb index cd495bd667..b252a4feb0 100644 --- a/lib/puppet/provider/sensu_redis_config/json.rb +++ b/lib/puppet/provider/sensu_redis_config/json.rb @@ -20,8 +20,9 @@ def flush def create conf['redis'] = {} - self.port = resource[:port] - self.host = resource[:host] + self.port = resource[:port] + self.host = resource[:host] + self.password = resource[:password] end def config_file @@ -51,4 +52,12 @@ def host def host=(value) conf['redis']['host'] = value end + + def password + conf['redis']['password'] + end + + def password=(value) + conf['redis']['password'] = value + end end diff --git a/lib/puppet/type/sensu_redis_config.rb b/lib/puppet/type/sensu_redis_config.rb index 8b0698641e..82c73a0c94 100644 --- a/lib/puppet/type/sensu_redis_config.rb +++ b/lib/puppet/type/sensu_redis_config.rb @@ -43,6 +43,10 @@ def initialize(*args) defaultto 'localhost' end + newproperty(:password) do + desc "The password used to connect to Redis" + end + autorequire(:package) do ['sensu'] end diff --git a/manifests/init.pp b/manifests/init.pp index 744dc12338..64dcd759a7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -118,6 +118,10 @@ # Integer. Redis port to be used by sensu # Default: 6379 # +# [*redis_password*] +# String. Password to be used to connect to Redis +# Default: '' +# # [*api_bind*] # String. IP to bind api service # Default: 0.0.0.0 @@ -219,6 +223,7 @@ $rabbitmq_ssl_cert_chain = undef, $redis_host = 'localhost', $redis_port = 6379, + $redis_password = '', $api_bind = '0.0.0.0', $api_host = 'localhost', $api_port = 4567, diff --git a/manifests/redis/config.pp b/manifests/redis/config.pp index d4bec1db3f..6ff77a487c 100644 --- a/manifests/redis/config.pp +++ b/manifests/redis/config.pp @@ -22,9 +22,10 @@ } sensu_redis_config { $::fqdn: - ensure => $ensure, - host => $sensu::redis_host, - port => $sensu::redis_port, + ensure => $ensure, + host => $sensu::redis_host, + port => $sensu::redis_port, + password => $sensu::redis_password, } } diff --git a/spec/classes/sensu_redis_spec.rb b/spec/classes/sensu_redis_spec.rb index 8be286b778..7fa27ae244 100644 --- a/spec/classes/sensu_redis_spec.rb +++ b/spec/classes/sensu_redis_spec.rb @@ -14,13 +14,15 @@ context 'be configurable' do let(:params) { { - :redis_host => 'redis.domain.com', - :redis_port => 1234 + :redis_host => 'redis.domain.com', + :redis_port => 1234, + :redis_password => 'password' } } it { should contain_sensu_redis_config('testhost.domain.com').with( - :host => 'redis.domain.com', - :port => 1234 + :host => 'redis.domain.com', + :port => 1234, + :password => 'password' )} end # be configurable