From c5462d4aac3adb3c5cb7b638aad6eb3159ee0a82 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Fri, 8 Dec 2017 13:39:36 +0100
Subject: [PATCH] roles/ipaserver/library/ipaserver_test: Return
 dns.ip_adresses and dns.reverse_zones

These global variables are initialized in the dns module in the
dns.install_check function. The settings are needed to be able to do a
proper dns setup in the ipaserver_setup_dns ansible module.
---
 roles/ipaserver/library/ipaserver_setup_dns.py | 7 +++++++
 roles/ipaserver/library/ipaserver_test.py      | 5 ++++-
 roles/ipaserver/tasks/install.yml              | 3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/roles/ipaserver/library/ipaserver_setup_dns.py b/roles/ipaserver/library/ipaserver_setup_dns.py
index 90605c8f..1255a00e 100644
--- a/roles/ipaserver/library/ipaserver_setup_dns.py
+++ b/roles/ipaserver/library/ipaserver_setup_dns.py
@@ -70,6 +70,9 @@ def main():
             forward_policy=dict(default='first', choices=['first', 'only']),
             no_dnssec_validation=dict(required=False, type='bool',
                                       default=False),
+            ### additional ###
+            dns_ip_addresses=dict(required=True, type='list'),
+            dns_reverse_zones=dict(required=True, type='list'),
         ),
     )
 
@@ -89,6 +92,10 @@ def main():
     options.forward_policy = ansible_module.params.get('forward_policy')
     options.no_dnssec_validation = ansible_module.params.get(
         'no_dnssec_validation')
+    ### additional ###
+    dns.ip_addresses = ansible_module_get_parsed_ip_addresses(
+        ansible_module, 'dns_ip_addresses')
+    dns.reverse_zones = ansible_module.params.get('dns_reverse_zones')
 
     # init ##################################################################
 
diff --git a/roles/ipaserver/library/ipaserver_test.py b/roles/ipaserver/library/ipaserver_test.py
index bcb9bc38..437e236d 100644
--- a/roles/ipaserver/library/ipaserver_test.py
+++ b/roles/ipaserver/library/ipaserver_test.py
@@ -772,7 +772,10 @@ def main():
                              forwarders=options.forwarders,
                              ### additional ###
                              _installation_cleanup=_installation_cleanup,
-                             domainlevel=options.domainlevel)
+                             domainlevel=options.domainlevel,
+                             dns_ip_addresses=[ str(ip) for ip
+                                                in dns.ip_addresses ],
+                             dns_reverse_zones=dns.reverse_zones)
 
 if __name__ == '__main__':
     main()
diff --git a/roles/ipaserver/tasks/install.yml b/roles/ipaserver/tasks/install.yml
index aa19f94a..69349e5a 100644
--- a/roles/ipaserver/tasks/install.yml
+++ b/roles/ipaserver/tasks/install.yml
@@ -352,6 +352,9 @@
       forward_policy: "{{ ipaserver_forward_policy | default(omit) }}"
       zonemgr: "{{ ipaserver_zonemgr | default(omit) }}"
       no_dnssec_validation: "{{ ipaserver_no_dnssec_validation }}"
+      ### additional ###
+      dns_ip_addresses: "{{ ipaserver_test.dns_ip_addresses }}"
+      dns_reverse_zones: "{{ ipaserver_test.dns_reverse_zones }}"
     when: ipaserver_setup_dns | bool
 
   - name: Install - Setup ADTRUST
-- 
GitLab