2

Here is custom fact:

require 'etc'

Etc.passwd do |user|
    Facter.add("homedir_#{user.name}".intern) do
        setcode { user.dir }
    end
end

It determine users home dir locations.

Here is defined type:

define ssh_keys::key ($user) {

    $home = $::homedir_#{user}

    if $home != undef {

    file { "$home/.ssh/":
        ensure => directory,
    }

    file { "$home/.ssh/authorized_keys":
        ensure => file,
        source => "puppet:///modules/ssh_keys/$user",
        }
    }

}

It does not work with $::homedir_#{user}, but works with exactly defined fact: $::homedir_root. What is wrong here?

1

Here is solution:

$mule = "ipaddress_${name}"
$donkey = inline_template("<%= scope.lookupvar(mule) %>")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.