From 61252fe74c8ec3668af551fb0b0b91f1bfa4705a Mon Sep 17 00:00:00 2001 From: varac Date: Sun, 21 May 2017 23:28:20 +0200 Subject: [vagrant] Use eth1 on vagrant if present Virtualbox adds eth1 as second interface when private networking is enabled. - Related: #7769 --- puppet/modules/site_config/manifests/params.pp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'puppet/modules/site_config/manifests/params.pp') diff --git a/puppet/modules/site_config/manifests/params.pp b/puppet/modules/site_config/manifests/params.pp index 012b3ce0..4627515a 100644 --- a/puppet/modules/site_config/manifests/params.pp +++ b/puppet/modules/site_config/manifests/params.pp @@ -1,3 +1,4 @@ +# Default parameters class site_config::params { $ip_address = hiera('ip_address') @@ -6,8 +7,16 @@ class site_config::params { $environment = hiera('environment', undef) - if $environment == 'local' { - $interface = 'eth1' + if $::vagrant { + # Depending on the backend hypervisor networking is setup differently. + if $::interfaces =~ /eth1/ { + # Virtualbox: Private networking creates a second interface eth1 + $interface = 'eth1' + } + else { + # KVM/Libvirt: Private networking is done by defauly on first interface + $interface = 'eth0' + } include site_config::packages::build_essential } elsif hiera('interface','') != '' { -- cgit v1.2.3 From 6482a4ccb3d72773cc6d00d5fa7933fa83c4cafe Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 5 Sep 2017 18:24:31 -0700 Subject: Bug: fix vpn network problem caused by vagrant fact Boolean facts must be escaped with str2bool. This commit includes new tests to catch VPN problems like this in the future. --- puppet/modules/site_config/manifests/params.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'puppet/modules/site_config/manifests/params.pp') diff --git a/puppet/modules/site_config/manifests/params.pp b/puppet/modules/site_config/manifests/params.pp index 4627515a..2c9687a3 100644 --- a/puppet/modules/site_config/manifests/params.pp +++ b/puppet/modules/site_config/manifests/params.pp @@ -6,8 +6,7 @@ class site_config::params { $ec2_local_ipv4_interface = getvar("interface_${::ec2_local_ipv4}") $environment = hiera('environment', undef) - - if $::vagrant { + if str2bool("$::vagrant") { # Depending on the backend hypervisor networking is setup differently. if $::interfaces =~ /eth1/ { # Virtualbox: Private networking creates a second interface eth1 -- cgit v1.2.3