Skip to content

Commit

Permalink
Add support for tagging hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
Patryk Ściborek committed Nov 8, 2018
1 parent 560bee1 commit e3a5805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ resolv-file = /etc/resolvconf/upstream.conf

{% if dnsmasq__dhcp_hosts is defined %}
{% for host in dnsmasq__dhcp_hosts %}
dhcp-host={{ host.mac }},{{ host.ip }}{% if host.name is defined %},{{ host.name }}{% else %}{% if host.lease_time is defined %},{% endif %}{% endif %}{% if host.lease_time is defined %},{{ host.lease_time }}{% else %},1d{% endif %}
dhcp-host={{ host.mac }},{% if host.tag is defined %}set:{{ host.tag }},{% endif %}{{ host.ip }}{% if host.name is defined %},{{ host.name }}{% else %}{% if host.lease_time is defined %},{% endif %}{% endif %}{% if host.lease_time is defined %},{{ host.lease_time }}{% else %},1d{% endif %}

{% endfor %}
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion docs/ansible/roles/debops.dnsmasq/defaults-detailed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ dnsmasq__dhcp_hosts

:envvar:`dnsmasq__dhcp_hosts` must be a list of hosts. Each host is a dictionary
consisting of a ``name``, a ``mac`` address, an :command:`ip` address and optionally a
``lease_time``; by default it's 1 day (``1d``).:
``tag`` or ``lease_time``; by default it's 1 day (``1d``).:

.. code-block:: yaml
dnsmasq__dhcp_hosts:
- name: client
mac: '01:23:45:67:89:ab'
ip: '192.168.0.42'
# optional
tag: 'R640'
# optional; default: 1d
lease_time: 12h

0 comments on commit e3a5805

Please sign in to comment.