2016-07-11

site.pp

$mysql = hiera_hash(mysql)
$network = hiera_hash(network)
$nfs = hiera_hash(nfs)

default.json

"mysql" : {},
"network" : {},
"nfs" : {},

This gives

Cannot reassign variable '$network' at /etc/puppetlabs/code/environments/prod/manifests/site.pp

Removing 'network' entry from default.json gives

Could not find data item network in any Hiera data file and no default supplied at /etc/puppetlabs/code/environments/prod/manifests/site.pp

Can anybody explain what's going on ?

Chris

Hiera v3.2, Puppet master 4 (2.4)

Well I did search for it, but all I got was

grep -r network manifests/
manifests/site.pp:$network = hiera_hash(network)
(none)

and

grep -r \$network modules/
modules/network/manifests/classes/tagging/configuration.pp: if $network['vlan'] {
modules/network/manifests/classes/tagging/configuration.pp: tagged_vlan { $network['vlan']: }

which leads to

define tagged_vlan() {

file { "/etc/sysconfig/network-scripts/ifcfg-bond0.${name}":
ensure => file,
content => template('network/etc/sysconfig/network-scripts/ifcfg-bond0.erb')
}

file { "/etc/sysconfig/network-scripts/ifcfg-bridge0.${name}":
ensure => file,
content => template('network/etc/sysconfig/network-scripts/ifcfg-bridge0.erb')
}

ifcfg-eth-vlan{ "eth0.${name}":
vlan => $name,
interface => "eth0",
}

ifcfg-eth-vlan{ "eth1.${name}":
vlan => $name,
interface => "eth1",
}

}

UPDATED: 2016-10-20

Hi Guys, so I still need an answer to this.

It works on a a client node, but not on the puppetmaster, but its the puppetmaster module ... sigh

puppet agent -t --noop --debug --verbose

last few lines
Debug: Facter: resolving load_average facts.
Debug: Facter: fact "load_averages" has resolved to {
15m => 0.01,
1m => 0,
5m => 0.01
}.
Debug: Facter: resolving Xen facts.
Debug: Failed to load library 'msgpack' for feature 'msgpack'
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: catalog supports formats: pson yaml dot binary
Debug: Using cached connection for https://puppetmaster103.ops.sac.int.threatmetrix.com:8140
Debug: Caching connection for https://puppetmaster103.ops.sac.int.threatmetrix.com:8140
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Cannot reassign variable '$network' at /etc/puppetlabs/code/environments/prod/manifests/site.pp:25:10 on node puppetmaster103.ops.sac.int.threatmetrix.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

and searching for 'network'

grep network prun_network_err.txt
Debug: Facter: resolving networking facts.
Debug: Facter: fact "network_eth0" has resolved to "10.200.0.0".
Debug: Facter: fact "network" has resolved to "10.200.0.0".
Debug: Facter: fact "network6_eth0" has resolved to "fe80::".
Debug: Facter: fact "network6" has resolved to "fe80::".
Debug: Facter: fact "network_lo" has resolved to "127.0.0.0".
Debug: Facter: fact "network6_lo" has resolved to "::1".
Debug: Facter: fact "networking" has resolved to {
network => "10.200.0.0"
network => "fe80::"
network => "10.200.0.0",
network6 => "fe80::"
network => "127.0.0.0"
network => "::1"
network => "127.0.0.0",
network6 => "::1"
network => "10.200.0.0",
network6 => "fe80::",
Debug: Facter: resolving networking facts.
Debug: Facter: fact "network_eth0" has resolved to "10.200.0.0".
Debug: Facter: fact "network" has resolved to "10.200.0.0".
Debug: Facter: fact "network6_eth0" has resolved to "fe80::".
Debug: Facter: fact "network6" has resolved to "fe80::".
Debug: Facter: fact "network_lo" has resolved to "127.0.0.0".
Debug: Facter: fact "network6_lo" has resolved to "::1".
Debug: Facter: fact "networking" has resolved to {
network => "10.200.0.0"
network => "fe80::"
network => "10.200.0.0",
network6 => "fe80::"
network => "127.0.0.0"
network => "::1"
network => "127.0.0.0",
network6 => "::1"
network => "10.200.0.0",
network6 => "fe80::",

No mention of $network as a variable.

Any ideas?

Chris

Show more