---
# Set common vars and facts for test.
- name: Set IPv4 address prefix.
  ansible.builtin.set_fact:
    ipv4_prefix: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
                     join('.') }}"
    ipv4_reverse: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
                      reverse |
                      join('.') }}"

- name: Set zone prefixes.
  ansible.builtin.set_fact:
    testzone: 'testzone.test'
    safezone: 'safezone.test'
    zone_ipv6_reverse: "ip6.arpa."
    zone_ipv6_reverse_workaround: "d.f.ip6.arpa."
    zone_prefix_reverse: "in-addr.arpa."
    zone_prefix_reverse_24: "{{ ipv4_reverse.split('.')[:] | join('.') }}.in-addr.arpa."
    zone_prefix_reverse_16: "{{ ipv4_reverse.split('.')[1:] | join('.') }}.in-addr.arpa."
    zone_prefix_reverse_8: "{{ ipv4_reverse.split('.')[2:] | join('.') }}.in-addr.arpa."
