Hi, can you move the notify next to the file resource instead of the variable declaration?
It seems most likely that there is some kind of scoping issue. HTH, Felix On 05/16/2015 07:46 PM, Adam Winberg wrote: > Hi, > > trying to populate an ifcfg template (network config) with ipv6 > config, but cant get one of my variables to show. The one I want to > use is "$ipv6_addr_cidr", but it just doesnt work, when my template is > created the variable is not defined. I can see the 'notify' which I > put right after defining $ipv6_addr_cidr, so I know I havent lost > myself in my if statements. I have other variables in my network.pp > (not shown below bc of snippet) which works. > > What am i doing wrong? Suspect it's something trivial, but I just cant > see it. Help would be really appreciated. > > > --------------------------------------- > network.pp (snippet) > > ################ > # IPv6 stuff > ################ > if str2bool($ipv6_enabled) { > > # Get the fourth octet from the node’s IPv4 address: > $i4 = regsubst($ip,'^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$','\4') > > # Set ipv6 address space > case $::network_eth0 { > "172.31.28.0": { $ipv6_space = "2001:67c:274:XXXX" } > "172.31.24.0": { $ipv6_space = "2001:67c:274:XXYY" } > default: { $ipv6_space = "undef" } > } > > if $ipv6_space != "undef" { > # Construct ipv6 address > $ipv6_addr = "${ipv6_space}::${i4}" > > # Add network to address string, used in ifcfg template later > $ipv6_addr_cidr = "${ipv6_addr}/64" > notify { "ipv6 addr: $ipv6_addr_cidr":} > } > > } > ################ > # END IPv6 stuff > ################ > > file { "ifcfg-$device": > path => "$cfgdir/ifcfg-$device", > owner => root, > group => root, > mode => 644, > ensure => present, > content => $ifcfg_template, > } > > --------------------------------------- > > ifcfg.erb > <% if @ipv6_addr_cidr -%> > #IPV6ADDR <%= @ipv6_addr_cidr %> > <% end -%> > > --------------------------------------- > > The results of above code is just: > #IPV6ADDR > > but no variable value. > > Regards, > Adam -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5558CD5B.2090600%40Alumni.TU-Berlin.de. For more options, visit https://groups.google.com/d/optout.