ansible/roles/dhcpd/templates/dhcpd.conf.j2

64 lines
1.8 KiB
Django/Jinja

{{ ansible_managed | comment }}
default-lease-time {{ dhcpd__default_lease_time }};
max-lease-time {{ dhcpd__max_lease_time }};
ddns-update-style none;
authoritative;
{% 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 %}
{% if dhcpd__dns_servers | default([]) %}
option domain-name-servers {{ dhcpd__dns_servers | join(", ") }};
{% endif %}
{% if dhcpd__domain_search | default([]) %}
option domain-search {{ dhcpd__domain_search
| map("enquote") | join(", ") }};
{% endif %}
{% for subnet in dhcpd__subnets %}
subnet {{ subnet.network
| ansible.utils.ipaddr("network") }}
netmask {{ subnet.network
| ansible.utils.ipaddr("netmask") }} {
pool {
range {{ subnet.start }} {{ subnet.end }};
{% if subnet.failover | default(false) %}
failover peer "peer";
{% endif %}
}
{% if subnet.routers | default([]) %}
option routers {{ subnet.routers | join(", ") }};
{% endif %}
}
{% endfor %}