From 8b8748f9c40d087bbae78eaf80f916d83bf40543 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 29 Feb 2024 12:41:26 +0100 Subject: [PATCH] sap_maintain_etc_hosts: use the regex method also for assert Relates to #667. Signed-off-by: Bernd Finger --- roles/sap_maintain_etc_hosts/tasks/update_host_absent.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_maintain_etc_hosts/tasks/update_host_absent.yml b/roles/sap_maintain_etc_hosts/tasks/update_host_absent.yml index dddf8f467..135023b18 100644 --- a/roles/sap_maintain_etc_hosts/tasks/update_host_absent.yml +++ b/roles/sap_maintain_etc_hosts/tasks/update_host_absent.yml @@ -1,7 +1,8 @@ --- - name: Verify that variable node_ip is in the correct format ansible.builtin.assert: - that: thishost.node_ip is ansible.utils.ip + that: thishost.node_ip | regex_search(sap_maintain_etc_hosts_regexp_ipv4) or + thishost.node_ip | regex_search(sap_maintain_etc_hosts_regexp_ipv6) msg: "Variable 'node_ip' is not an IP address. Please use the correct format" when: thisnode.node_ip is defined