modules: dhcp: Add an mgmt module for managing dhcpd
This is not perfect, but it's a good start, and it shows how a module might be structured.
This commit is contained in:
55
modules/dhcp/files/dhcpd.conf.tmpl
Normal file
55
modules/dhcp/files/dhcpd.conf.tmpl
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# This file has been generated by mgmt config. Do not edit.
|
||||
#
|
||||
|
||||
# DHCP Server Configuration file.
|
||||
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
|
||||
# see dhcpd.conf(5) man page
|
||||
#
|
||||
|
||||
#
|
||||
# global option definitions
|
||||
#
|
||||
{{ if .domain -}}
|
||||
option domain-name "{{ .domain }}";
|
||||
{{ end -}}
|
||||
{{ if .dns -}}
|
||||
option domain-name-servers {{ .dns }};
|
||||
{{ end -}}
|
||||
|
||||
#
|
||||
# dhcpd settings
|
||||
#
|
||||
{{ if .omapiport -}}
|
||||
#omapi-port {{ .omapiport }}; # FIXME !
|
||||
{{ end -}}
|
||||
{{ if .serveridentifier -}}
|
||||
#server-identifier {{ .serveridentifier }}; # FIXME !
|
||||
{{ end -}}
|
||||
default-lease-time {{ .defaultleasetime }};
|
||||
max-lease-time {{ .maxleasetime }};
|
||||
|
||||
# Use this to enable / disable dynamic dns updates globally.
|
||||
#ddns-update-style none;
|
||||
|
||||
# If this DHCP server is the official DHCP server for the local
|
||||
# network, the authoritative directive should be uncommented.
|
||||
{{ if .authoritative -}}
|
||||
authoritative;
|
||||
{{ else -}}
|
||||
#authoritative; # not authoritative!
|
||||
{{ end -}}
|
||||
|
||||
# Use this to send dhcp log messages to a different log file (you also
|
||||
# have to hack syslog.conf to complete the redirection).
|
||||
log-facility local7;
|
||||
|
||||
#
|
||||
# include all the subnet definitions
|
||||
#
|
||||
include "/etc/dhcp/subnets.conf";
|
||||
|
||||
#
|
||||
# include all the hosts
|
||||
#
|
||||
include "/etc/dhcp/hosts.conf";
|
||||
19
modules/dhcp/files/host.frag.tmpl
Normal file
19
modules/dhcp/files/host.frag.tmpl
Normal file
@@ -0,0 +1,19 @@
|
||||
{{/* newline for host spacing */}}
|
||||
# host: {{ .name }}
|
||||
host {{ .name }} {
|
||||
hardware ethernet {{ .macaddress }};
|
||||
fixed-address {{ .valid_fixedaddress }};
|
||||
{{- if .hostname }}
|
||||
option host-name "{{ .hostname }}";
|
||||
{{ end -}}
|
||||
{{- if .nextserver }}
|
||||
next-server {{ .nextserver }};
|
||||
{{ end -}}
|
||||
{{- if .filename }}
|
||||
filename "{{ .filename }}";
|
||||
{{ end -}}
|
||||
{{- if .veo }}
|
||||
filename "{{ .filename }}";
|
||||
option vendor-encapsulated-options {{ .veo }};
|
||||
{{ end -}}
|
||||
}
|
||||
3
modules/dhcp/files/hosts.header
Normal file
3
modules/dhcp/files/hosts.header
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
# This has been generated by mgmt config. Do not edit.
|
||||
#
|
||||
34
modules/dhcp/files/subnet.frag.tmpl
Normal file
34
modules/dhcp/files/subnet.frag.tmpl
Normal file
@@ -0,0 +1,34 @@
|
||||
{{/* newline for subnet spacing */}}
|
||||
#
|
||||
# {{ .name }} subnet
|
||||
#
|
||||
subnet {{ .network }} netmask {{ .netmask }} {
|
||||
option subnet-mask {{ .netmask }};
|
||||
{{- if .broadcast }}
|
||||
option broadcast-address {{ .broadcast }};
|
||||
{{ end -}}
|
||||
{{- if .router }}
|
||||
option routers {{ .router }};
|
||||
{{ end -}}
|
||||
{{- if .dns }}
|
||||
option domain-name-servers {{ .dns }};
|
||||
{{ end -}}
|
||||
{{- if .nextserver }}
|
||||
next-server {{ .nextserver }};
|
||||
{{ end -}}
|
||||
{{- if .filename }}
|
||||
filename "{{ .filename }}";
|
||||
{{ end -}}
|
||||
{{- if .serveridentifier }}
|
||||
server-identifier {{ .serveridentifier }};
|
||||
{{ end -}}
|
||||
{{- if .defaultleasetime }}
|
||||
default-lease-time {{ .defaultleasetime }};
|
||||
{{ end -}}
|
||||
{{- if .maxleasetime }}
|
||||
max-lease-time {{ .maxleasetime }};
|
||||
{{ end -}}
|
||||
{{- if .range }}
|
||||
range {{ .range }};
|
||||
{{ end -}}
|
||||
}
|
||||
3
modules/dhcp/files/subnets.header
Normal file
3
modules/dhcp/files/subnets.header
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
# This has been generated by mgmt config. Do not edit.
|
||||
#
|
||||
Reference in New Issue
Block a user