instack-undercloud/elements/ironic-discoverd/install.d/50-discovery-dnsmasq

38 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# just starts the discovery dnsmasq process
set -eux
# TODO(marios): add systemd Environment or EnvironmentFile and upstart
# env for IFACE and DISCOVERY_POOL
# IFACE=br-ctlplane
# DISCOVERY_POOL=192.0.2.100,192.0.2.120
install-packages dnsmasq dnsmasq-utils
# make sure tftpboot is labelled correctly
mkdir -p /tftpboot
restorecon -R /tftpboot
cat > /lib/systemd/system/discovery-dhcp-dnsmasq.service << eof
[Unit]
Description=Discovery dhcp dnsmasq service
After=openvswitch.service
[Service]
Type=forking
ExecStart=/sbin/dnsmasq --conf-file= \\
--port=0 \\
--enable-tftp \\
--tftp-root=/tftpboot \\
--dhcp-boot=pxelinux.0,localhost.localdomain,192.0.2.1 \\
--bind-interfaces \\
--pid-file=/var/run/dnsmasq.pid \\
--interface=br-ctlplane \\
--dhcp-range=192.0.2.100,192.0.2.120,29
[Install]
WantedBy=multi-user.target
Alias=discovery-dhcp-dnsmasq.service
eof
# Enable the service
os-svc-enable -n discovery-dhcp-dnsmasq