ok I found a workaround to my problem. I updated the network module
(https://forge.puppetlabs.com/razorsedge/network) so that it is now
accepting a label as the name rather than interface (eth0 etc). In this way
I can provide a unique name and get away with assigning same name leading
to error. then I introduced a new parameter to module to accept interface.
For example my data now updated as follows.
/etc/puppet/hieradata/admin1.json
{
"networks":{
"admin1-admin":{
"interface":"eth0",
"ipaddress":"192.168.1.1",
"netmask":"255.255.255.0"
}
}
}
But I still like to know is it possible to use the create_resources and
virtual resources together where I need to pass hieradata also.
Thanks,
CD
On Thursday, January 16, 2014 1:57:41 PM UTC+10, CD wrote:
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/230210ae-163d-462b-a36a-4f0503be9ccc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.