From a6a05cd9fc019db127e18898b3ab3e624644a8b5 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Fri, 14 Feb 2014 01:24:15 +0100 Subject: custom ip address fact --- manifests/base.pp | 8 ++++++-- manifests/init.pp | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/manifests/base.pp b/manifests/base.pp index a0f1872..a7a61a6 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -1,4 +1,6 @@ -class sshd::base { +class sshd::base( + $ipaddres_fact = $sshd::ipaddres_fact, +) { $sshd_config_content = $::lsbdistcodename ? { '' => template("sshd/sshd_config/${::operatingsystem}.erb"), @@ -27,8 +29,10 @@ class sshd::base { } # In case the node has uses a shared network address, # we don't define a sshkey resource using an IP address + $ipaddr = inline_template("<%= scope.lookupvar(ipaddr_fact) %>") if $sshd::shared_ip == 'no' { - @@sshkey{$::ipaddress: + @@sshkey{$ipaddr: + ensure => present, tag => 'ipaddress', type => ssh-rsa, diff --git a/manifests/init.pp b/manifests/init.pp index fb76438..927bbc6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,7 +33,8 @@ class sshd( $tail_additional_options = '', $print_motd = 'yes', $manage_shorewall = false, - $shorewall_source = 'net' + $shorewall_source = 'net', + $ipaddres_fact = 'ipaddress', ) { validate_bool($manage_shorewall) -- cgit v1.2.3