Conditional File Include

Bob Harold rharolde at umich.edu
Mon Aug 7 13:36:20 UTC 2017


On Mon, Aug 7, 2017 at 8:34 AM, Norman Elton <normelton at gmail.com> wrote:

> 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
>

git has a ".gitignore" file where you can list files and directories to be
ignored.  Try listing the symlink file in .gitignore.

Otherwise, I would just put the symlink somewhere outside the directories
controlled by git.

-- 
Bob Harold
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20170807/bfa630d0/attachment.html>


More information about the dhcp-users mailing list