From 20fee0111f71fe4ba73ed6bd618720c4710a865f Mon Sep 17 00:00:00 2001 From: Gaspard Micol Date: Tue, 3 Dec 2024 11:21:52 -0500 Subject: [PATCH] [ignore] Enables flexible requirements during ND setup for app and service network for both IPv4 and IPv6 addresses. --- plugins/modules/nd_setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/modules/nd_setup.py b/plugins/modules/nd_setup.py index b010b93..c17ac9d 100644 --- a/plugins/modules/nd_setup.py +++ b/plugins/modules/nd_setup.py @@ -164,7 +164,6 @@ description: - The management IP address of the node. type: str - required: true username: description: - The username of the node. @@ -400,7 +399,7 @@ def main(): hostname=dict(type="str", required=True), serial_number=dict(type="str", required=True), role=dict(type="str", default="primary", choices=["primary", "secondary", "standby"], aliases=["type"]), - management_ip_address=dict(type="str", required=True), + management_ip_address=dict(type="str"), username=dict(type="str", required=True), password=dict(type="str", required=True, no_log=True), management_network=dict(type="dict", required=True, options=network_spec()), @@ -415,7 +414,7 @@ def main(): argument_spec=argument_spec, supports_check_mode=True, required_if=[ - ["state", "present", ["cluster_name", "dns_server", "app_network", "service_network", "nodes"]], + ["state", "present", ["cluster_name", "dns_server", "nodes"]], ], required_together=[ ["proxy_username", "proxy_password"], @@ -450,6 +449,12 @@ def main(): else: nd_version = nd.query_obj("/version.json") nd_version = ".".join(str(nd_version[key]) for key in ["major", "minor", "maintenance"]) + if nd_version >= "3.0.1": + if not all((app_network, service_network)) and not all((app_network_ipv6, service_network_ipv6)): + nd.fail_json(msg="Application and service network addresses, IPv4 or IPv6, are required during ND setup.") + else: + if not all((app_network, service_network)): + nd.fail_json(msg="Application and service network IPv4 addresses are required during ND setup.") if len(cluster_name) > 63: nd.fail_json("A length of 1 to 63 characters is allowed.") elif len(re.findall(r"[^a-zA-Z0-9-]", cluster_name)) > 0: