jomrr / ansible-role-samba-dc

Ansible role for setting up samba as active directory domain controller.
MIT License
2 stars 1 forks source link

Playbook Failing #7

Open elproducto opened 1 year ago

elproducto commented 1 year ago

Thanks for creating this playbook. They Playbook really make setting up a Samba DC easy as changing a few variables. I noticed the playbook was failing for me with the following error. Not sure if I was running it incorrectly, but I made the following changes to the facts.yml file, and all worked well.

Error

TASK [ansible-role-samba-dc : Facts | Set facts derived from variables or other gathered facts] ************************************************************************************************************
fatal: [REDACTED]: FAILED! => {"msg": "Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipaddr filter <value>"}

Changes made

-        {% set zone = hostvars[inventory_hostname]['ansible_' + iface].ipv4.address | ipaddr('revdns') | regex_replace('^([0-9]+)\\.>(.*)\\.', '\\2') -%}
-        {% set ptr = hostvars[inventory_hostname]['ansible_' + iface].ipv4.address | ipaddr('revdns') | regex_replace('\\.$', '') -%}
+        {% set zone = hostvars[inventory_hostname]['ansible_default_ipv4']['address'] | ansible.utils.ipaddr('revdns') | regex_replace('^([0-9]+)\\.(.*)\\.', '\\2') -%}
+        {% set ptr = hostvars[inventory_hostname]['ansible_default_ipv4']['address'] | ansible.utils.ipaddr('revdns') | regex_replace('\\.$', '') -%}
jomrr commented 1 year ago

Hi @elproducto, thanks for reaching out. I currently do not have much time but will review this on the upcoming easter weekend :)

First guess: On modern versions of ansible you need the ansible.utils package and also python-netaddr package installed on the ansible controller...