2022-08-20 16:08:25 +02:00
|
|
|
{{ ansible_managed | comment }}
|
|
|
|
|
|
|
|
default-lease-time {{ dhcpd__default_lease_time }};
|
|
|
|
max-lease-time {{ dhcpd__max_lease_time }};
|
|
|
|
|
|
|
|
ddns-update-style none;
|
|
|
|
|
|
|
|
authoritative;
|
|
|
|
|
2022-08-20 16:53:10 +02:00
|
|
|
{% if dhcpd__omapi_key | default({}) %}
|
|
|
|
omapi-port {{ dhcpd__omapi_port }};
|
|
|
|
omapi-key omapi_key;
|
|
|
|
|
|
|
|
key omapi_key {
|
|
|
|
algorithm {{ dhcpd__omapi_key.algorithm }};
|
|
|
|
secret {{ dhcpd__omapi_key.secret }};
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if dhcpd__subnets | selectattr("failover", "true") | list %}
|
|
|
|
failover peer "peer" {
|
|
|
|
{% if dhcpd__failover_primary | default(false) %}
|
|
|
|
primary;
|
|
|
|
mclt {{ dhcpd__failover_mclt }};
|
|
|
|
split {{ dhcpd__failover_split }};
|
|
|
|
{% else %}
|
|
|
|
secondary;
|
|
|
|
{% endif %}
|
|
|
|
address {{ dhcpd__failover_address }};
|
|
|
|
port {{ dhcpd__failover_port }};
|
|
|
|
peer address {{ dhcpd__failover_peer_address }};
|
|
|
|
peer port {{ dhcpd__failover_peer_port
|
|
|
|
| default(dhcpd__failover_port) }};
|
|
|
|
max-response-delay {{ dhcpd__failover_max_response_delay }};
|
|
|
|
max-unacked-updates {{ dhcpd__failover_max_unacked_updates }};
|
|
|
|
load balance max seconds {{ dhcpd__failover_lb_max_seconds }};
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
2022-08-20 16:08:25 +02:00
|
|
|
{% if dhcpd__dns_servers | default([]) %}
|
|
|
|
option domain-name-servers {{ dhcpd__dns_servers | join(", ") }};
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if dhcpd__domain_search | default([]) %}
|
2022-08-20 16:53:10 +02:00
|
|
|
option domain-search {{ dhcpd__domain_search
|
|
|
|
| map("enquote") | join(", ") }};
|
2022-08-20 16:08:25 +02:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% for subnet in dhcpd__subnets %}
|
|
|
|
subnet {{ subnet.network
|
|
|
|
| ansible.utils.ipaddr("network") }}
|
|
|
|
netmask {{ subnet.network
|
|
|
|
| ansible.utils.ipaddr("netmask") }} {
|
2022-08-20 16:53:10 +02:00
|
|
|
pool {
|
|
|
|
range {{ subnet.start }} {{ subnet.end }};
|
|
|
|
{% if subnet.failover | default(false) %}
|
|
|
|
failover peer "peer";
|
|
|
|
{% endif %}
|
|
|
|
}
|
2022-08-20 16:08:25 +02:00
|
|
|
{% if subnet.routers | default([]) %}
|
|
|
|
option routers {{ subnet.routers | join(", ") }};
|
|
|
|
{% endif %}
|
|
|
|
}
|
|
|
|
{% endfor %}
|