diff --git a/manifests/init.pp b/manifests/init.pp index 4b3a320410..d3932b3d83 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -48,6 +48,11 @@ # Default: true # Valid values: true, false # +# [*manage_user*] +# Boolean. Manage the sensu user with puppet +# Default: true +# Valid values: true, false +# # [*rabbitmq_port*] # Integer. Rabbitmq port to be used by sensu # Default: 5671 @@ -164,6 +169,7 @@ $api = false, $dashboard = false, $manage_services = true, + $manage_user = true, $rabbitmq_port = 5671, $rabbitmq_host = 'localhost', $rabbitmq_user = 'sensu', diff --git a/manifests/package.pp b/manifests/package.pp index 1fcddff157..41e3178652 100644 --- a/manifests/package.pp +++ b/manifests/package.pp @@ -54,17 +54,19 @@ require => Package['sensu'], } - user { 'sensu': - ensure => 'present', - system => true, - home => '/opt/sensu', - shell => '/bin/false', - comment => 'Sensu Monitoring Framework', - } + if $sensu::manage_user { + user { 'sensu': + ensure => 'present', + system => true, + home => '/opt/sensu', + shell => '/bin/false', + comment => 'Sensu Monitoring Framework', + } - group { 'sensu': - ensure => 'present', - system => true, + group { 'sensu': + ensure => 'present', + system => true, + } } file { '/etc/sensu/config.json': ensure => absent } diff --git a/spec/classes/sensu_init_spec.rb b/spec/classes/sensu_init_spec.rb index 1eb95494fc..3ade7f4fdd 100644 --- a/spec/classes/sensu_init_spec.rb +++ b/spec/classes/sensu_init_spec.rb @@ -3,6 +3,12 @@ describe 'sensu', :type => :class do it 'should compile' do should create_class('sensu') end + it { should contain_user('sensu') } + + context 'with manage_user => false' do + let(:params) { {:manage_user => false} } + it { should_not contain_user('sensu') } + end end