diff --git a/manifests/client/config/user.pp b/manifests/client/config/user.pp index 9e4aa508..2a2de3d3 100644 --- a/manifests/client/config/user.pp +++ b/manifests/client/config/user.pp @@ -9,13 +9,12 @@ Hash $options = {}, Optional[Stdlib::Absolutepath] $target = undef, Optional[Stdlib::Absolutepath] $user_home_dir = undef, + String $user = $name, ) { include ::ssh::params - $_files_ensure = $ensure ? { 'present' => 'file', 'absent' => 'absent' } - # If a specific target file was specified, # it must have higher priority than any # other parameter. @@ -25,7 +24,7 @@ } else { if ($user_home_dir == undef) { - $_user_home_dir = "/home/${name}" + $_user_home_dir = "/home/${user}" } else { validate_absolute_path($user_home_dir) @@ -36,20 +35,28 @@ $_target = "${user_ssh_dir}/config" if ($manage_user_ssh_dir == true) { - file { $user_ssh_dir: - ensure => directory, - owner => $name, - mode => $::ssh::params::user_ssh_directory_default_mode, - before => File[$_target], + unless defined(File[$user_ssh_dir]) { + file { $user_ssh_dir: + ensure => directory, + owner => $user, + mode => $::ssh::params::user_ssh_directory_default_mode, + before => Concat_file[$_target], + } } } } - file { $_target: - ensure => $_files_ensure, - owner => $name, - mode => $::ssh::params::user_ssh_config_default_mode, + unless defined(Concat_file[$_target]) { + concat_file{$_target: + ensure => $ensure, + owner => $user, + mode => $::ssh::params::user_ssh_config_default_mode, + tag => $user, + } + } + concat_fragment{$name: + tag => $user, content => template("${module_name}/ssh_config.erb"), + target => $_target, } - } diff --git a/metadata.json b/metadata.json index 0d18d5ba..1d0d1f7a 100644 --- a/metadata.json +++ b/metadata.json @@ -52,7 +52,7 @@ }, { "name": "puppetlabs/concat", - "version_requirement": ">= 1.2.5 < 3.0.0" + "version_requirement": ">= 2.2.0 < 3.0.0" } ] }