config: add dhcpOpts, import from salt-pillar

This commit is contained in:
Astro 2021-03-27 02:07:14 +01:00
parent 9afc25d6c3
commit 74c10c0446
2 changed files with 37 additions and 0 deletions

View File

@ -25,6 +25,13 @@ in
(builtins.mapAttrs (_: vlan: { vlan = vlan; }) pillar.vlans)
(builtins.mapAttrs (_: subnet4: { inherit subnet4; }) pillar.subnets-inet)
(builtins.mapAttrs (_: hosts4: { inherit hosts4; }) pillar.hosts-inet)
(builtins.mapAttrs (_: dhcpData: {
dhcp = {
inherit (dhcpData) start end time max-time;
router = dhcpData.host-opts.routers;
domainName = dhcpData.string-opts.domain-name;
};
}) pillar.dhcp)
{ core.ospf.secret = pillar.ospf.secret; }
] ++ (
map (ctx:

View File

@ -2,6 +2,32 @@
with lib;
let
dhcpOpts = {
start = mkOption {
description = "First IP address in pool";
type = types.str;
};
end = mkOption {
description = "Last IP address in pool";
type = types.str;
};
time = mkOption {
description = "Renew time in seconds";
type = types.int;
};
max-time = mkOption {
description = "Max renew time in seconds";
type = types.int;
};
router = mkOption {
description = "Gateway";
type = types.str;
};
domainName = mkOption {
description = "Domain name option";
type = types.str;
};
};
netOpts = { name, ... }: {
options = {
vlan = mkOption {
@ -45,6 +71,10 @@ let
default = null;
};
};
dhcp = mkOption {
type = with types; nullOr (submodule { options = dhcpOpts; });
default = null;
};
};
};
interfaceOpts = { name, ... }: {