Open axelag opened 2 months ago
A wrapper profile like the following should work. Assuming you known of and follow the Roles & Profiles pattern that has been long established as a best practice in Puppet:
class profile::network {
$if_defaults = lookup('profile::network::interface_defaults', Hash, 'deep', {})
$interfaces = lookup('profile::network::interfaces', Hash, 'deep', {})
$route_defaults = lookup('profile::network::route_defaults', Hash, 'deep', {})
$routes = lookup('profile::network::routes', Hash, 'deep', {})
create_resources('network_config', $interfaces, $if_defaults)
create_resources('network_route', $routes, $route_defaults)
}
You Puppet node should include 'profile::network'
, then in Hiera you can do something like this:
profile::network::interfaces:
lo:
ensure: present
family: inet
method: loopback
enp5s0:
ensure: present
family: inet
method: static
address: 10.1.2.3/24
options:
gateway: 10.1.2.1
Hello, is there any way to create a network interface and routes with Hiera? I can't seem to do it, any examples?