systemli / ansible-role-bind9

Ansible role to install and maintain the Bind9 nameserver on Debian
GNU General Public License v3.0
24 stars 26 forks source link

Support for port in forwarders #61

Closed codezninja closed 1 year ago

codezninja commented 1 year ago

New to ansible and bind so forgive me if this is an easy question. I'm trying to setup a consul forwarder and it requires that I also add port to the named.config based on this documentation https://developer.hashicorp.com/consul/tutorials/networking/dns-forwarding#zone-file. Now looking through the template. It seems like it only supports ip address. Is there a way to override the default template or even add support to the default template to add a port?

https://github.com/systemli/ansible-role-bind9/blob/d6b74e219be7cf3e87a68e8910ede6bda0e2415f/templates/bind/named.conf.local.j2#L72-L76

0xMattijs commented 1 year ago

You could simply add the port keyword to your bind9_forward_servers like this:

    bind9_forward_servers:
      - 1.2.3.4 port 5353
      - 8.8.8.8

This will result into the following (valid) configuration section in named.conf.options:

  forwarders {
          1.2.3.4 port 5353;
          8.8.8.8;
      };
codezninja commented 1 year ago

Thank you so much that worked.