Skip to content

Commit

Permalink
Add variables: dnsmasq__group_options, dnsmasq__host_options
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid committed Aug 27, 2016
1 parent d44a389 commit fe220a7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Added

- Allow to use custom upstream nameservers. [ypid_]

- Add :envvar:`dnsmasq__group_options` and :envvar:`dnsmasq__host_options` with
the same function as ``dnsmasq_options``. [ypid_]

Changed
~~~~~~~

Expand Down
22 changes: 19 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ dnsmasq_dhcpv6: True
#
# Enable or disable local router support (no routing information is sent to
# hosts, DHCPv6 doesn't work).
# True means to announce the machine where dnsmasq is running as default
# ``True`` means to announce the machine where dnsmasq is running as default
# gateway unless the gateway was explicitly given in :envvar:`dnsmasq_interfaces`.
# False means to not announce any default route.
# ``False`` means to not announce any default route.
dnsmasq_router: True


Expand Down Expand Up @@ -210,10 +210,26 @@ dnsmasq_tftp_ipxe: True

# .. envvar:: dnsmasq_options
#
# Additional options passed as a YAML text block
# Additional options passed as a YAML text block.
# This variable is intended to be used in Ansible’s global inventory.
dnsmasq_options: ''


# .. envvar:: dnsmasq__group_options
#
# Additional options passed as a YAML text block.
# This variable is intended to be used in a host inventory group of Ansible
# (only one host group is supported).
dnsmasq__group_options: ''


# .. envvar:: dnsmasq__host_options
#
# Additional options passed as a YAML text block.
# This variable is intended to be used in the inventory of hosts.
dnsmasq__host_options: ''


# Configuration for other Ansible roles [[[
# -----------------------------------------

Expand Down
14 changes: 13 additions & 1 deletion templates/etc/dnsmasq.d/00_main.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,19 @@ resolv-file = /etc/resolvconf/upstream.conf
{% endif %}

{% if dnsmasq_options|d() %}
# ---- Custom options ----
# ---- Global custom options ----

{{ dnsmasq_options }}
{% endif %}

{% if dnsmasq__group_options|d() %}
# ---- Group custom options ----

{{ dnsmasq__group_options }}
{% endif %}

{% if dnsmasq__host_options|d() %}
# ---- Host custom options ----

{{ dnsmasq__host_options }}
{% endif %}
1 change: 1 addition & 0 deletions templates/etc/dnsmasq.d/interface.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dhcp-range = set:{{ item.interface }},{{ element | ipv6(item.dhcp_range_start |
dhcp-option = tag:{{ item.interface }},option:router,{{ item.gateway }}
{% else %}
# IPv4 router address.
# The special address 0.0.0.0 is taken to mean "the address of the machine running dnsmasq"
dhcp-option = tag:{{ item.interface }},option:router,0.0.0.0
{% endif %}
{% else %}
Expand Down

0 comments on commit fe220a7

Please sign in to comment.