dhcpd.conf.j2 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. ## dhcpd.conf
  2. # {{ ansible_managed }}
  3. # Do not edit manually
  4. {% if dhcp_omapi_port is defined %}
  5. omapi-port {{ dhcp_omapi_port }};
  6. {% endif %}
  7. # option definitions common to all supported networks...
  8. {% if dhcp_common_domain is defined %}
  9. option domain-name "{{ dhcp_common_domain }}";
  10. {% endif %}
  11. {% if dhcp_common_nameservers is defined %}
  12. option domain-name-servers {{ dhcp_common_nameservers }};
  13. {% endif %}
  14. {% if dhcp_common_default_lease_time is defined %}
  15. default-lease-time {{ dhcp_common_default_lease_time }};
  16. {% endif %}
  17. {% if dhcp_common_max_lease_time is defined %}
  18. max-lease-time {{ dhcp_common_max_lease_time }};
  19. {% endif %}
  20. {% if dhcp_common_ddns_update_style is defined %}
  21. # Use this to enable / disable dynamic dns updates globally.
  22. ddns-update-style {{ dhcp_common_ddns_update_style }};
  23. {% endif %}
  24. {% if dhcp_common_authoritative is defined %}
  25. # If this DHCP server is the official DHCP server for the local
  26. # network, the authoritative directive should be uncommented.
  27. authoritative;
  28. {% endif %}
  29. {% if dhcp_common_log_facility is defined %}
  30. # Use this to send dhcp log messages to a different log file (you also
  31. # have to hack syslog.conf to complete the redirection).
  32. log-facility {{ dhcp_common_log_facility }};
  33. {% endif %}
  34. {% if dhcp_common_options is defined %}
  35. #DHCP options
  36. {% for o in dhcp_common_options %}
  37. option {{ o }};
  38. {% endfor %}
  39. {% endif %}
  40. {% if dhcp_common_parameters is defined %}
  41. #DHCP parameters
  42. {% for p in dhcp_common_parameters %}
  43. {{ p }};
  44. {% endfor %}
  45. {% endif %}
  46. # Classes
  47. {% for c in dhcp_classes %}
  48. class "{{ c.name }}" {
  49. {{ c.rule }};
  50. {% if c.options is defined %}
  51. {% for i in c.options %}
  52. option {{ i.opt }};
  53. {% endfor %}
  54. {% endif %}
  55. }
  56. {% endfor %}
  57. # Subnets
  58. {% for s in dhcp_subnets %}
  59. subnet {{ s.base }} netmask {{ s.netmask }} {
  60. {% if s.range_start is defined %}
  61. range {{ s.range_start }} {{ s.range_end }};
  62. {% endif %}
  63. {% if s.routers is defined %}
  64. option routers {{ s.routers }};
  65. {% endif %}
  66. {% if s.broadcast_address is defined %}
  67. option broadcast-address {{ s.broadcast_address }};
  68. {% endif %}
  69. {% if s.domain_nameservers is defined %}
  70. option domain-name-servers {{ s.domain_nameservers }};
  71. {% endif %}
  72. {% if s.domain_name is defined %}
  73. option domain-name "{{ s.domain_name }}";
  74. {% endif %}
  75. {% if s.ntp_servers is defined %}
  76. option ntp-servers {{ s.ntp_servers }};
  77. {% endif %}
  78. {% if s.default_lease_time is defined %}
  79. default-lease-time {{ s.default_lease_time }};
  80. {% endif %}
  81. {% if s.max_lease_time is defined %}
  82. max-lease-time {{ s.max_lease_time }};
  83. {% endif %}
  84. {% if s.pools is defined %}
  85. {% for p in s.pools %}
  86. pool {
  87. {% if p.rule is defined %}
  88. {{ p.rule }};
  89. {% endif %}
  90. range {{ p.range_start }} {{ p.range_end }};
  91. {% if p.parameters is defined %}
  92. {% for param in p.parameters %}
  93. {{ param }};
  94. {% endfor %}
  95. {% endif %}
  96. }
  97. {% endfor %}
  98. {% endif %}
  99. {% if s.parameters is defined %}
  100. {% for p in s.parameters %}
  101. {{ p }};
  102. {% endfor %}
  103. {% endif %}
  104. }
  105. {% endfor %}
  106. # Hosts
  107. {% for h in dhcp_hosts %}
  108. host {{ h.name }} {
  109. hardware ethernet {{ h.mac_address }};
  110. {% if h.fixed_address is defined %}
  111. fixed-address {{ h.fixed_address }};
  112. {% endif %}
  113. {% if h.routers is defined %}
  114. option routers {{ h.routers }};
  115. {% endif %}
  116. {% if h.broadcast_address is defined %}
  117. option broadcast-address {{ h.broadcast_address }};
  118. {% endif %}
  119. {% if h.domain_nameservers is defined %}
  120. option domain-name-servers {{ h.domain_nameservers }};
  121. {% endif %}
  122. {% if h.domain_name is defined %}
  123. option domain-name "{{ h.domain_name }}";
  124. {% endif %}
  125. {% if h.default_lease_time is defined %}
  126. default-lease-time {{ h.default_lease_time }};
  127. {% endif %}
  128. {% if h.max_lease_time is defined %}
  129. max-lease-time {{ h.max_lease_time }};
  130. {% endif %}
  131. {% if h.parameters is defined %}
  132. {% for p in h.parameters %}
  133. {{ p }};
  134. {% endfor %}
  135. {% endif %}
  136. }
  137. {% endfor %}
  138. # Shared networks
  139. {% for n in dhcp_shared_networks %}
  140. shared-network {{ n.name }} {
  141. {% for s in n.subnets %}
  142. subnet {{ s.base }} netmask {{ s.netmask }} {
  143. {% if s.range_start is defined %}
  144. range {{ s.range_start }} {{ s.range_end }};
  145. {% endif %}
  146. {% if s.routers is defined %}
  147. option routers {{ s.routers }};
  148. {% endif %}
  149. {% if s.broadcast_address is defined %}
  150. option broadcast-address {{ s.broadcast_address }};
  151. {% endif %}
  152. {% if s.domain_nameservers is defined %}
  153. option domain-name-servers {{ s.domain_nameservers }};
  154. {% endif %}
  155. {% if s.domain_name is defined %}
  156. option domain-name "{{ s.domain_name }}";
  157. {% endif %}
  158. {% if s.default_lease_time is defined %}
  159. default-lease-time {{ s.default_lease_time }};
  160. {% endif %}
  161. {% if s.max_lease_time is defined %}
  162. max-lease-time {{ s.max_lease_time }};
  163. {% endif %}
  164. {% if s.parameters is defined %}
  165. {% for param in s.parameters %}
  166. {{ param }};
  167. {% endfor %}
  168. {% endif %}
  169. }
  170. {% endfor %}
  171. {% for p in n.pools %}
  172. pool {
  173. {{ p.rule }};
  174. range {{ p.range_start }} {{ p.range_end }};
  175. {% if p.parameters is defined %}
  176. {% for param in p.parameters %}
  177. {{ param }};
  178. {% endfor %}
  179. {% endif %}
  180. }
  181. {% endfor %}
  182. {% if n.parameters is defined %}
  183. {% for p in n.parameters %}
  184. {{ p }};
  185. {% endfor %}
  186. {% endif %}
  187. }
  188. {% endfor %}
  189. {% if dhcp_ifelse is defined %}
  190. # If else clauses
  191. {% for ie in dhcp_ifelse %}
  192. if {{ ie.condition }} {
  193. {{ ie.val }}
  194. }{% if ie.else is defined %}{% for e in ie.else %} else {
  195. {{ e.val }}
  196. }{% endfor %}
  197. {% endif %}
  198. {% endfor %}
  199. {% endif %}