dubzland / ansible-role-bind9

Ansible role to install and configure the Bind DNS server.
MIT License
0 stars 0 forks source link

Error definind zone in view #2

Open kemeris2000 opened 3 years ago

kemeris2000 commented 3 years ago

I get error "No first item, sequence was empty" when defining zone in view.

dubzland_bind9_views:
  - name: internal
    match_clients:
      - internals
    recursion: 'no'
    includes:
      - '/etc/named.conf.internals'
    zones:
      - name: domain1.com
        type: master
        domain_name: domain1.com
TASK [ansible-role-bind : ensure view based zone files exist] ******************
fatal: [maria1.vm.domain1.com]: FAILED! => {"msg": "No first item, sequence was empty."}

Any ideas what could be wrong?

t3hpr1m3 commented 3 years ago

@kemeris2000 At first glance, it looks like the error is caused by the lack of nameservers defined in the zone (see here: https://github.com/dubzland/ansible-role-bind9/blob/46c3627587b43109cf9c4cec9023f0b21279f38f/action_plugins/bind9_zone.py#L21).

I'll add a check for that and generate a better error message. In the meantime, define some nameservers (at least the one you're configuring) and you should be ok.

kemeris2000 commented 3 years ago

@t3hpr1m3 You are right, problem because of missing nameservers. The following works:

dubzland_bind9_views:
  - name: internal
    match_clients:
      - internals
    recursion: 'no'
    includes:
      - '/etc/named.conf.internals'
    zones:
      - name: domain1.com
        type: master
        domain_name: domain1.com
        nsupdate_key: DHCP_UPDATER
        nameservers:
          - name: ns1.domain1.com
          - name: ns1.domain1.com

I think you should update example, as you code expect list of dictionary for nameservers instead of list.

https://github.com/dubzland/ansible-role-bind9/blob/46c3627587b43109cf9c4cec9023f0b21279f38f/defaults/main.yml#L28-L34