I'm trying to create a task that verifies a variable is a valid IP address. 
 The task should pass if it is valid, and fail if it's not.
I feel like I'm close, but not quite there with this:

  - name: Verify IP address
    assert: { that: "{{ requested_ip | ipaddr }}" }
    always_run: yes


This task fails properly when the value is not an IP (ipaddr filter returns 
False), but if it IS an IP it tries to evaluate the ip itself and throws an 
error (ipaddr returns the IP itself):

TASK [Verify IP address] **************************** fatal: [localhost]: 
FAILED! => {"failed": true, "msg": "The conditional check '10.1.4.232 != 
False' failed. The error was: error while evaluating conditional 
(10.1.4.232 != False): float object has no element 4"}

 Any suggestions?

Thanks,
Ryan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/19b42c0a-a989-458c-a276-4ba8da4f800a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to