---
- name: Generate DNS records
  include_tasks: generate-dns.yml

- name: "Remove DNS A records"
  nsupdate:
    key_name: "{{ item.0.key_name }}"
    key_secret: "{{ item.0.key_secret }}"
    key_algorithm: "{{ item.0.key_algorithm }}"
    server: "{{ item.0.server }}"
    zone: "{{ item.0.zone }}"
    record: "{{ item.1.fqdn | replace('.' + openshift_openstack_nsupdate_zone, '') }}"
    value: "{{ item.1.ip }}"
    type: "{{ item.1.type }}"
    state: absent
  with_subelements:
    - "{{ openshift_openstack_dns_records | default([]) }}"
    - entries
  register: nsupdate_remove_result
  until: nsupdate_remove_result is succeeded
  retries: 10
  delay: 1
