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

[BUG] role fails when I upgraded to python 3.9 and ansible 2.13 #42

Closed ulvida closed 2 years ago

ulvida commented 2 years ago

Exploring tests, I realized that my debian PC, while updated to bullseye, was still using python 2.7 as default for python command. When I did the switch, bind9 role stopped working, failing without any change in configuration in this task:

TASK [systemli.bind9 : determine if DNSSEC keys for zones already exist] ********************************************************************************************************************
fatal: [guabiyu.interior.edu.uy]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'name'\n\nThe error appears to be in '/home/ulvida/tech/interior/UdelaRInterior/systemli.bind9/tasks/main.yml': line 147, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# TODO: DNSSEC: implement key rollover\n- name: determine if DNSSEC keys for zones already exist\n  ^ here\n"}

My evironement is:

ulvida@paname:~$ ansible --version
ansible [core 2.13.0]
  config file = /home/ulvida/tech/interior/config/ansible.cfg
  configured module search path = ['/home/ulvida/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ulvida/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/ulvida/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.1.2
  libyaml = True
ulvida commented 2 years ago

The role still works on my laptop, where:

ulvida@qhispy:~/tech/interior/config$ ansible --version
ansible 2.10.8
  config file = /home/ulvida/tech/interior/config/ansible.cfg
  configured module search path = ['/home/ulvida/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]

It may come from ansible version.

ulvida commented 2 years ago

Debugging, I saw that "{{ bind9_zones_dynamic }} + {{ bind9_zones_static }}" was no longer producing the expected result of the union of the two zones' lists. I solved it replacing this expression by:

with_items:
    - '{{ bind9_zones_dynamic | union( bind9_zones_static ) }}'

I test and submit it in our next PR.

ulvida commented 2 years ago

Debugging, I saw that "{{ bind9_zones_dynamic }} + {{ bind9_zones_static }}" was no longer producing the expected result of the union of the two zones' lists.

This solution also solves the problem:

 with_items:
     - '{{ bind9_zones_dynamic + bind9_zones_static }}'
t2d commented 2 years ago

thx