From 849c4dba1f5c8bed4055254b04d89dde9c71e702 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 25 Feb 2016 16:23:02 +0100 Subject: [PATCH] make it possible to also overwrite the address that is exported --- manifests/instance.pp | 8 +++++++- manifests/switch.pp | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index ea60c2a..a8759d3 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -4,6 +4,7 @@ define tinc::instance( $connect_on_boot = true, $tinc_interface = 'eth0', $tinc_address = undef, + $tinc_address_to_export = undef, $port = '655', $port_to_export = '655', $compression = '10', @@ -95,6 +96,11 @@ define tinc::instance( $int_name_escaped = regsubst($tinc_interface,'\.','_','G') $host_address = getvar("::ipaddress_${int_name_escaped}") } + if $tinc_address_to_export { + $export_addr = $tinc_address_to_export + } else { + $export_addr = $host_address + } # get the keys # [ priv, pub ] @@ -117,7 +123,7 @@ define tinc::instance( @@tinc::host{"${fqdn_tinc}@${name}": port => $port_to_export, compression => $compression, - address => $host_address, + address => $export_addr, public_key => $tinc_keys[1], tag => "tinc::host_for_${name}", } diff --git a/manifests/switch.pp b/manifests/switch.pp index 65b8c42..3c7e65b 100644 --- a/manifests/switch.pp +++ b/manifests/switch.pp @@ -5,6 +5,7 @@ define tinc::switch( $tinc_interface = 'eth0', $tinc_address = undef, $port = '655', + $tinc_address_to_export = undef, $port_to_export = '655', $tinc_internal_interface = 'eth1', $tinc_internal_ip = 'absent', @@ -15,14 +16,15 @@ define tinc::switch( ){ tinc::instance{$name: - ensure => $ensure, - connect_on_boot => $connect_on_boot, - tinc_interface => $tinc_interface, - tinc_address => $tinc_address, - port => $port, - port_to_export => $port_to_export, - compression => $compression, - mode => 'switch', + ensure => $ensure, + connect_on_boot => $connect_on_boot, + tinc_interface => $tinc_interface, + tinc_address => $tinc_address, + tinc_address_to_export => $tinc_address_to_export, + port => $port, + port_to_export => $port_to_export, + compression => $compression, + mode => 'switch', } if $ensure == 'present' {