d344f3045c
provide UniFi Controller IP via Option 43
123 lines
3.2 KiB
Django/Jinja
123 lines
3.2 KiB
Django/Jinja
#
|
|
# {{ ansible_managed }}
|
|
#
|
|
{
|
|
|
|
"Dhcp4":
|
|
{
|
|
"interfaces-config": {
|
|
"interfaces": [
|
|
{% for mesh in meshes %}
|
|
{% if not loop.last %}
|
|
"{{ mesh.id }}br",
|
|
{% else %}
|
|
"{{ mesh.id }}br"
|
|
{% endif %}
|
|
{% endfor %}
|
|
]
|
|
},
|
|
"control-socket": {
|
|
"socket-type": "unix",
|
|
"socket-name": "/tmp/kea-dhcp4-ctrl.sock"
|
|
},
|
|
"lease-database": {
|
|
"type": "memfile",
|
|
"persist": true,
|
|
"lfc-interval": {{ kea_lease_database['lfc_interval'] }}
|
|
},
|
|
"expired-leases-processing": {
|
|
"reclaim-timer-wait-time": {{ kea_expired_leases_processing['reclaim_timer_wait_time'] }},
|
|
"flush-reclaimed-timer-wait-time": {{ kea_expired_leases_processing['flush_reclaimed_timer_wait_time'] }} ,
|
|
"hold-reclaimed-time": {{ kea_expired_leases_processing['hold_reclaimed_time'] }},
|
|
"max-reclaim-leases": {{ kea_expired_leases_processing['max_reclaim_leases'] }},
|
|
"max-reclaim-time": {{ kea_expired_leases_processing['max_reclaim_time'] }},
|
|
"unwarned-reclaim-cycles": {{ kea_expired_leases_processing['unwarned_reclaim_cycles'] }}
|
|
},
|
|
"valid-lifetime": {{ kea_lease_time }},
|
|
"option-def": [
|
|
{
|
|
"name": "unifi-address",
|
|
"code": 1,
|
|
"type": "ipv4-address",
|
|
"space": "ubnt"
|
|
}
|
|
],
|
|
{% if unifi_server is defined %}
|
|
"client-classes": [
|
|
{
|
|
"name": "ubnt",
|
|
"test": "substring(option[vendor-class-identifier].text, 0, 4) == 'ubnt'",
|
|
"option-def": [
|
|
{
|
|
"name": "vendor-encapsulated-options",
|
|
"code": 43,
|
|
"type": "empty",
|
|
"encapsulate": "ubnt"
|
|
}
|
|
],
|
|
"option-data": [
|
|
{
|
|
"name": "vendor-class-identifier",
|
|
"data": "ubnt"
|
|
},
|
|
{
|
|
"name": "unifi-address",
|
|
"space": "ubnt",
|
|
"data": "{{ loopback_net_ipv4 | ipaddr(hostvars[unifi_server + '.' + http_domain_external ]['magic']) | ipaddr('address') }}"
|
|
},
|
|
{
|
|
"name": "vendor-encapsulated-options"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
{% endif %}
|
|
"subnet4": [
|
|
{% for mesh in meshes %}
|
|
{
|
|
"subnet": "{{ mesh.ipv4_network | ipaddr('network/prefix') }}",
|
|
"pools": [ { "pool": "{{ mesh_gw_prefixes[mesh.id].ipv4_dhcp | ipaddr('net') | ipaddr('range_usable') }}" } ],
|
|
"option-data": [
|
|
{
|
|
"name": "routers",
|
|
"data": "{{ mesh.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') }}"
|
|
},
|
|
{
|
|
"name": "time-servers",
|
|
"data": "{{ mesh.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') }}"
|
|
},
|
|
{
|
|
"name": "domain-name-servers",
|
|
"data": "{{ mesh.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') }}"
|
|
}{% if mesh.dnssl is defined %},
|
|
{
|
|
"name": "domain-search",
|
|
"data": "{% for dnssl in mesh.dnssl %}{{ dnssl }}{% if not loop.last %}, {% endif %}{% endfor %}"
|
|
}
|
|
{% endif %}
|
|
]
|
|
{% if not loop.last %}
|
|
},
|
|
{% else %}
|
|
}
|
|
]
|
|
{% endif %}
|
|
{% endfor %}
|
|
},
|
|
"Logging":
|
|
{
|
|
"loggers": [
|
|
{
|
|
"name": "kea-dhcp4",
|
|
"output_options": [
|
|
{
|
|
"output": "/var/log/kea/kea-dhcp4.log"
|
|
}
|
|
],
|
|
"severity": "WARN",
|
|
"debuglevel": 0
|
|
}
|
|
]
|
|
}
|
|
|
|
}
|