openstack-ansible-ops/pxelinux-provisioning/playbooks/templates/dhcp/dhcpd.conf.j2
Kevin Carter 743b939640 Add basic provisioning using pxelinux
The basic provisioning tools we had in the MNAIO could long be used on a
set of physical machines however doing so required a healthy
understanding of everything going on under the hood. This change
extracts the PXE components out of our older MNAIO tooling and
will allow operators to easily deploy operating systems on machines in
the most compatible way possible.

Change-Id: I2188f0f0de7f8be331a35b5f22cf5114ea9b6718
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-05-01 15:42:04 +00:00

51 lines
1.7 KiB
Django/Jinja

ddns-update-style none;
allow booting;
allow bootp;
log-facility local7;
authoritative;
shared-network all-networks {
{% for dhcp in default_dhcp_list %}
subnet {{ dhcp.subnet }} netmask {{ dhcp.netmask }} {
option routers {{ dhcp.gateway }};
option domain-name-servers {{ dhcp.dns }};
option subnet-mask {{ dhcp.netmask }};
{% if dhcp.default_lease_time is defined and dhcp.default_lease_time > 0 %}
default-lease-time {{ dhcp.default_lease_time }};
{% else %}
default-lease-time {{ dhcp_default_lease_time }};
{% endif %}
{% if dhcp.max_lease_time is defined and dhcp.max_lease_time > 0 %}
max-lease-time {{ dhcp.max_lease_time }};
{% else %}
max-lease-time {{ dhcp_max_lease_time }};
{% endif %}
{% if dhcp.tftp_server is defined and dhcp.tftp_server | ipaddr %}
next-server {{ dhcp.tftp_server }};
{% elif default_tftp_server is defined and default_tftp_server | length > 0 %}
next-server {{ default_tftp_server }};
{% endif %}
{% if dhcp.tftp_boot_path is defined and dhcp.tftp_boot_path | ipaddr %}
filename "{{ dhcp.tftp_boot_path }}";
{% elif default_tftp_boot_path is defined and default_tftp_boot_path | length > 0 %}
filename "{{ default_tftp_boot_path }}";
{% endif %}
}
{% endfor %}
group {
{% for item in groups['pxe_servers'] %}
host {{ hostvars[item]['server_hostname'] }} {
hardware ethernet {{ hostvars[item]['server_mac_address'] | upper }};
fixed-address {{ hostvars[item]['server_fixed_addr'] }};
option host-name "{{ hostvars[item]['server_hostname'] }}";
}
{% endfor %}
}
}