Dear users,
I am quite new to Puppet and need some help in following scenario. This
could be not possible or the way I think might be completely not in line
with the Puppet. I believe experts can help me with a solution/suggestion.
I am planning to use hiera to specify all variable values for a system and
then perform the configuration based on that file. In this I am planning to
keep all data in single file common.json rather than files based on
certname such as admin1.json.
hiera data file common.json
{
"servers":{
"admin":{
"networks":{
"eth0":{
"ip":"10.10.10.1"
},
"eth1":{
"ip":"10.10.20.1"
}
}
}
}
}
then I am planning to use the module razorsedge/network from puppet forge
to configure the network interfaces. Following snippet doesn't work most
probably I am not doing the right thing. But what want to achieve when I
include following modules in nodes, it pickup the hiera data and configure
the network interfaces based on the configuration data in common.json file.
Based on common.json file requirement is that, following snippet will
configure all interfaces iterating through the data.
# Get all the servers
$servers = hiera("servers")
# Get the nics configuration for the hostname where agent runs.
$nics = $servers["$::hostname"]['networks']
# Following will run twice one for eth0 and eth1. When it run for eth0 it
will configure ip 10.10.10.1 to configure and when it runs for eth1 it will
configure ip 10.10.20.1
network_config { "$nics":
"ip" => $nics[$name]["ip"]
}
Specific problems I face:
1. hiera($variable) returns a hash but for resource to iterate it requires
and array. Any idea how to convert it to an array
2. How to specify ip so that it get the corresponding value from eth0 or
eth1.
Many 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/b17f9a9f-5795-477b-8f66-728dfe0cd93a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.