Conditional File Include

Norman Elton normelton at gmail.com
Mon Aug 7 12:34:19 UTC 2017


We keep our DHCP configuration in a git repository. In the case of
failover pairs, they share a repository. This works great, since the
vast majority of the configuration is identical.

Of course, the failover configuration is different between the two
servers. To solve this, my dhcpd.conf file does an include on
"dhcp-failover.conf", which doesn't actually exist in the repository.
Instead, it's a symlink to either "dhcp-failover-01.conf" or
"dhcp-failover-02.conf". This works, but I have to manually create the
symlink when we check out the repository.

Not the end of the world, but it would be much smoother to say:

include "dhcp-failover-${HOSTNAME}"

So that the dhcpd.conf file automatically points to the correct
failover config file.

Is there any way to include a variable in an included path name? Or
conditionally include a file?

Thanks!

Norman Elton


More information about the dhcp-users mailing list