From: Luca Filipozzi Date: Wed, 16 May 2012 08:12:52 +0000 (+0000) Subject: can't call hiera() from templates? X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=e1f71e92e65b162bf75157c44ad15b6a2bdfb85b;p=mirror%2Fdsa-puppet.git can't call hiera() from templates? --- diff --git a/modules/ssh/manifests/init.pp b/modules/ssh/manifests/init.pp index 0824f0f89..455d32208 100644 --- a/modules/ssh/manifests/init.pp +++ b/modules/ssh/manifests/init.pp @@ -1,5 +1,8 @@ class ssh { + nodes = hiera('nodes', nil, {'cluster' => hiera('cluster')}) + $rootkeys = nodes.collect{|x| hiera('rootkey', nil, {'hostname' => x})} + package { [ 'openssh-client', 'openssh-server']: ensure => installed } diff --git a/modules/ssh/templates/authorized_keys.erb b/modules/ssh/templates/authorized_keys.erb index ce054cdb2..597c79762 100644 --- a/modules/ssh/templates/authorized_keys.erb +++ b/modules/ssh/templates/authorized_keys.erb @@ -24,10 +24,7 @@ localkeys end ganetikeys %> -<%= - nodes = hiera('nodes', nil, {'cluster' => hiera('cluster')}) - nodes.collect{|x| hiera('rootkey', nil, {'hostname' => x})} -%> +<%= rootkeys.join("\n") %> # # DSA #