Hi friends,

I have an issue where that I receive error Error 400 on SERVER: Cannot 
reassign variable name on node app1. When I run the agent on admin1 it 
works fine, but when I run the agent on app1 it give me the error.

Having read few forum posts it seems this is most likely that the same 
resource is used. resource network::if::static is used with eth0 in the 
same class when it runs for admin1 and app1. I believe when it run on 
admin1 variables are used without any problem and when it run on app1 it 
find the variable has been used for admin1. It appears these kind of issues 
are addressed by creating virtual resources. However I cannot figure out 
how I can define virtual resources and combine that with create_resources. 
I need to use the create_resources because I was to pass the hieradata to 
the resource.

*Any ideas how I can address this problem?*

Details of the implementation given below:

I have following hieradata which applied to each server:

/etc/puppet/hieradata/admin1.json
{
   "networks":{
      "eth0":{
         "ipaddress":"192.168.1.1",
         "netmask":"255.255.255.0"
      }
   }
}

/etc/puppet/hieradata/app1.json
{
   "networks":{
      "eth0":{
         "ipaddress":"192.168.1.2",
         "netmask":"255.255.255.0"
      }
   }
}

I have a class call foundation and it has following files
/etc/puppet/modules/foundation/manifests/init.pp
class foundation {
    include foundation::network
}

/etc/puppet/modules/foundation/manifests/network.pp
class foundation::network{

    # Defaults for network configuration
    $nic_default = {
        'ensure' => 'up'
    }

    # Extract Data from Hiera for the host in concern
    $nics   = hiera("networks",{})

    # Configure networks based on the parameters
    create_resources(network::if::static, $nics, $nic_default)

}

Above class is included in base node and individual nodes has extended from 
the base node
/etc/puppet/manifests/nodes.pp
node base {
   include foundation
}

node admin1 inherits base {
}

node app1 inherits base {
}

Thanks,
CD

-- 
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/23a6858d-6a4c-4d71-95fa-524867c56f2a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to