diff --git a/manifests/profile/network.pp b/manifests/profile/network.pp index de9ece8d096cc513343a4b2fea46b0afbcb4dd21..17b14809bd090ab0214e54cfa3ae57c39f7bc468 100644 --- a/manifests/profile/network.pp +++ b/manifests/profile/network.pp @@ -28,17 +28,17 @@ class tails::profile::network ( create_resources('network_config', $interfaces) -# if we only have 1 interface defined here, we can be sure this is the +# if we have at least 1 interface defined here, we assume the first of them has the # IP we want to share for other hosts to add to their /etc/hosts file. if $export_host { - if $interfaces.length == 1 { - $interfaces.each | String $iface, Hash $config | { - @@host { $facts['networking']['fqdn']: - ip => $config['ipaddress'], - host_aliases => $facts['networking']['hostname'], - tag => 'hello_neighbour', - } + if $interfaces.length >= 1 { + $iface = $interfaces.keys[0] + $config = $interfaces[$iface] + @@host { $facts['networking']['fqdn']: + ip => $config['ipaddress'], + host_aliases => $facts['networking']['hostname'], + tag => 'hello_neighbour', } } }