diff --git a/manifests/init.pp b/manifests/init.pp index c9076c95..42711256 100755 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -444,6 +444,8 @@ $service_hasstatus = $docker::params::service_hasstatus, $service_hasrestart = $docker::params::service_hasrestart, $run_init_template = $docker::params::run_init_template, + $run_init_file_mode = $docker::params::run_init_file_mode, + $run_init_file_group = $docker::params::run_init_file_group, ) inherits docker::params { validate_string($version) diff --git a/manifests/params.pp b/manifests/params.pp index aceb8c24..823b6d97 100755 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -74,6 +74,8 @@ $storage_config_template = 'docker/etc/sysconfig/docker-storage.erb' $compose_version = '1.9.0' $compose_install_path = '/usr/local/bin' + $run_init_file_mode = undef + $run_init_file_group = undef case $::osfamily { 'Debian' : { diff --git a/manifests/run.pp b/manifests/run.pp index c042b201..996258b6 100755 --- a/manifests/run.pp +++ b/manifests/run.pp @@ -114,6 +114,8 @@ $stop_wait_time = 0, $syslog_identifier = undef, $init_template = $docker::run_init_template, + $xinit_file_mode = $docker::run_init_file_mode, + $xinit_file_group = $docker::run_init_file_group, ) { include docker::params if ($socket_connect != []) { @@ -123,7 +125,11 @@ $docker_command = $docker::params::docker_command } $service_name = $docker::params::service_name - $docker_group = $docker::params::docker_group + + $docker_group = $xinit_file_group ? { + undef => $docker::params::docker_group, + default => $xinit_file_group, + } validate_re($image, '^[\S]*$') validate_re($title, '^[\S]*$') @@ -258,37 +264,55 @@ ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '15.04') >= 0) { $initscript = "/etc/systemd/system/${service_prefix}${sanitised_title}.service" $uses_systemd = true - $mode = '0640' + $mode = $xinit_file_mode ? { + undef => '0640', + default => $xinit_file_mode, + } } else { $uses_systemd = false $initscript = "/etc/init.d/${service_prefix}${sanitised_title}" $init_template = 'docker/etc/init.d/docker-run.erb' - $mode = '0750' + $mode = $xinit_file_mode ? { + undef => '0750', + default => $xinit_file_mode, + } } } 'RedHat': { if ($::operatingsystem == 'Amazon') or (versioncmp($::operatingsystemrelease, '7.0') < 0) { $initscript = "/etc/init.d/${service_prefix}${sanitised_title}" $hasstatus = undef - $mode = '0750' + $mode = $xinit_file_mode ? { + undef => '0750', + default => $xinit_file_mode, + } $uses_systemd = false } else { $initscript = "/etc/systemd/system/${service_prefix}${sanitised_title}.service" $hasstatus = true - $mode = '0640' + $mode = $xinit_file_mode ? { + undef => '0640', + default => $xinit_file_mode, + } $uses_systemd = true } } 'Archlinux': { $initscript = "/etc/systemd/system/${service_prefix}${sanitised_title}.service" $hasstatus = true - $mode = '0640' + $mode = $xinit_file_mode ? { + undef => '0640', + default => $xinit_file_mode, + } $uses_systemd = true } 'Gentoo': { $initscript = "/etc/init.d/${service_prefix}${sanitised_title}" $hasstatus = true - $mode = '0770' + $mode = $xinit_file_mode ? { + undef => '0770', + default => $xinit_file_mode, + } $uses_systemd = false } default: {