keav4.conf.j2 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {
  2. "Dhcp4": {
  3. "interfaces-config": {
  4. "interfaces": [ {% for domaene in domaenenliste|dictsort %}"bat{{domaene[0]}}"{% if not loop.last %}, {% endif %}{% endfor %} ]
  5. },
  6. "control-socket": {
  7. "socket-type": "unix",
  8. "socket-name": "/var/kea/control.sock"
  9. },
  10. "lease-database": {
  11. {% if kea.database.type == "memfile" %}
  12. "type": "memfile",
  13. "persist": {{kea.database.persistent | lower}},
  14. "name": "{{kea.database.location}}",
  15. "lfc-interval": {{kea.database.lfc_interval}}
  16. {% elif kea.database.type == "postgresql" %}
  17. "type": "postgresql",
  18. "name": "{{kea.database.db_name}}",
  19. "user": "{{kea.database.db_user}}",
  20. "password": "{{kea.database.db_pass}}",
  21. "host": "{{kea.database.db_host}}"
  22. {% endif %}
  23. },
  24. "expired-leases-processing": {
  25. {% for attribute in kea.expired_leases %}
  26. "{{attribute.name}}": {{attribute.value}}{% if not loop.last %},{% endif %}
  27. {% endfor %}
  28. },
  29. "valid-lifetime": {{kea.global.lease_default}},
  30. "option-data": [
  31. {
  32. "name": "interface-mtu",
  33. "code": 26,
  34. "space": "dhcp4",
  35. "csv-format": true,
  36. "data": "{{kea.global.mtu}}"
  37. }
  38. ],
  39. "subnet4": [
  40. {% for domaene in domaenenliste|dictsort %}
  41. {
  42. "subnet": "{{domaenen[domaene[0]].ffv4_network}}",
  43. "interface": "bat{{domaene[0]}}",
  44. "id" : {{domaene[0]}},
  45. "pools": [
  46. { "pool": "{{domaene[1].dhcp_start}} - {{domaene[1].dhcp_ende}}" }
  47. ],
  48. {% if domaenen[domaene[0]].dhcp is defined and domaenen[domaene[0]].dhcp.reservations is defined %}
  49. "reservations" : [
  50. {% for host in domaenen[domaene[0]].dhcp.reservations %}
  51. {
  52. "hw-address" : "{{host.id}}",
  53. "ip-address" : "{{host.ip}}"
  54. }{% if not loop.last %},{% endif %}
  55. {% endfor %}
  56. ],
  57. {% endif %}
  58. "option-data": [
  59. {
  60. "name": "routers",
  61. "code": 3,
  62. "space": "dhcp4",
  63. "csv-format": true,
  64. "data": "{{domaenen[domaene[0]].ffv4_network | ipaddr(domaene[1].server_id) | ipaddr('address') }}{% if kea.routers.all_gateways is defined and kea.routers.all_gateways == True %}{% for gateway in groups['supernodes'] %}{% if gateway != inventory_hostname and domaene[0] in hostvars[gateway].domaenenliste %}, {{domaenen[domaene[0]].ffv4_network | ipaddr(hostvars[gateway].domaenenliste[domaene[0]].server_id) | ipaddr('address') }}{% endif %}{% endfor %}{% endif %}"
  65. },
  66. {
  67. "name": "domain-name-servers",
  68. "code": 6,
  69. "space": "dhcp4",
  70. "csv-format": true,
  71. "data": "{{domaenen[domaene[0]].ffv4_network | ipaddr(domaene[1].server_id) | ipaddr('address') }}{% if kea.dns.all_gateways is defined and kea.dns.all_gateways == True %}{% for gateway in groups['supernodes'] %}{% if gateway != inventory_hostname and domaene[0] in hostvars[gateway].domaenenliste %}, {{domaenen[domaene[0]].ffv4_network | ipaddr(hostvars[gateway].domaenenliste[domaene[0]].server_id) | ipaddr('address') }}{% endif %}{% endfor %}{% endif %}{% if kea.dns.additional %}{% for entry in kea.dns.additional %}, {{entry}}{% endfor %}{% endif %}"
  72. },
  73. {
  74. "name": "domain-name",
  75. "code": 15,
  76. "space": "dhcp4",
  77. "csv-format": true,
  78. "data": "{{kea.global.search_domain}}"
  79. }
  80. ]
  81. }{% if not loop.last %},{% endif %}
  82. {% endfor %}
  83. ]
  84. },
  85. "Logging": {
  86. "loggers": [
  87. {% for logger in kea.loggers %}
  88. {
  89. "name": "{{logger.name}}",
  90. "output_options": [ {
  91. "output": "{{logger.file}}"
  92. } ],
  93. "severity": "{{logger.level}}"
  94. }{% if not loop.last %},{% endif %}
  95. {% endfor %}
  96. ]
  97. }
  98. }