From 02a834f9da513a7af14ba09a13da0cc529ee6373 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Wed, 23 Jan 2013 15:37:35 +0200 Subject: [PATCH] Added ec2_public_ipv4 to host_aliases in ssh::known_hosts --- ssh/manifests/init.pp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ssh/manifests/init.pp b/ssh/manifests/init.pp index c47a78d..166fdef 100644 --- a/ssh/manifests/init.pp +++ b/ssh/manifests/init.pp @@ -12,14 +12,19 @@ class ssh::known_hosts { }, } + $shortname = inline_template("<%= homename.split('.')[0] %>") + + if $::ec2_public_ipv4 { + $aliases = [ $shortname, $::ipaddress, $::ec2_public_ipv4 ] + } else { + $aliases = [ $shortname, $::ipaddress ] + } + @@sshkey { $homename: ensure => present, type => rsa, key => $sshrsakey, - host_aliases => [ - inline_template("<%= homename.split('.')[0] %>"), - $::ipaddress, - ], + host_aliases => $aliases, require => File["/etc/ssh/ssh_known_hosts"], }