diff --git a/manifests/mongos/service.pp b/manifests/mongos/service.pp index 639b24802..93ea19b36 100644 --- a/manifests/mongos/service.pp +++ b/manifests/mongos/service.pp @@ -66,7 +66,7 @@ if $service_manage { systemd::unit_file { 'mongos.service': - content => epp($service_template, { service_user => $service_user, service_group => $service_user }), + content => epp($service_template, { service_user => $service_user, service_group => $service_group }), enable => $real_service_enable, } ~> Service['mongos'] diff --git a/spec/classes/mongos_spec.rb b/spec/classes/mongos_spec.rb index 5e7d68b88..35629a941 100644 --- a/spec/classes/mongos_spec.rb +++ b/spec/classes/mongos_spec.rb @@ -32,7 +32,14 @@ # service it { is_expected.to contain_class('mongodb::mongos::service') } + it { is_expected.to contain_service('mongos') } + + it { + is_expected.to contain_systemd__unit_file('mongos.service') + .with_content(%r{RuntimeDirectory=mongodb}) + .with_content(%r{RuntimeDirectoryMode=0755}) + } end describe 'with specific bind_ip values' do diff --git a/templates/mongos/mongos.service-dropin.epp b/templates/mongos/mongos.service-dropin.epp index 7a5e63eca..2fc75a779 100644 --- a/templates/mongos/mongos.service-dropin.epp +++ b/templates/mongos/mongos.service-dropin.epp @@ -9,6 +9,8 @@ Documentation=https://docs.mongodb.org/manual After=network.target [Service] +RuntimeDirectory=mongodb +RuntimeDirectoryMode=0755 User=<%= $service_user %> Group=<%= $service_group %> Environment="OPTIONS=-f /etc/mongos.conf"