Wrap text
Theme:
Clean (Pastie)
All Hallow's Eve
Blackboard
Brilliance Black
Cobalt
Espresso Libre
IDLE
Mac Classic
MagicWB (Amiga)
Pastels on Dark
Slate
Slush and Poppies
Sunburst
Sunburst (Josh)
Twilight
Vibrant Ink
Report abuse
Function
module Puppet:: Parser:: Functions
newfunction (:currhost_containedin , :type => :rvalue ) do |args |
currhost = lookupvar ('hostname' )
return args[0 ].include ("#{currhost} " )
end
end
Manifest example
class ssh_keys {
@ssh_userkeys {
"storage" :
privkeyname => "id_rsa" ,
fromhosts => ["log2" ,"universe" ],
dotsshpath => "/home/storage/.ssh" ;
}
define ssh_userkeys ( $dotsshpath , $privkeyname , $type = "rsa" , $fromhosts ){
$copypriv = currhost_containedin ($fromhosts )
if $copypriv == $hostname {
file { "privkey_${name}_${privkeyname}" :
owner => $name ,
group => $name ,
ensure => "file" ,
path => "$dotsshpath/$privkeyname" ,
mode => "0600" ,
content => $privkey_contents ,
require => File [$dotsshpath , $authkeysfile ];
}
}
}
}
Failure message
root@foo :~
info: Retrieving facts
err: Could not retrieve catalog: undefined method `include' for "log2":String at /etc/puppet/manifests/definitions/definitions.pp:177 on node foo.domain.tld
warning: Not using cache on failed catalog