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/CAFCL3Hui8qd8JxE_45ytXzppM6LgwmKHKLZAJUZXGV4ZwNqiDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to