Skip to content

url

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version 2.14.

Synopsis

  • Validates a string to conform to the URL standard.

Parameters

Parameter Defaults / Choices Comments
_input
string
required
Possible URL.
schemes
list / elements=string
Subset of URI schemas to validate against, otherwise B(any) scheme is considered valid.

Examples

# simple URL
{{ 'http://example.com' is url }}
# looking only for file transfers URIs
{{ 'mailto://nowone@example.com' is not uri(schemes=['ftp', 'ftps', 'sftp', 'file']) }}
#  but it is according to standard
{{ 'mailto://nowone@example.com' is not uri }}
# more complex URL
{{ 'ftp://admin:secret@example.com/path/to/myfile.yml' is url }}

Return Values

Key Data Type Description Returned
_value boolean Returns V(false) if the string is not a URL, V(true) otherwise.

Authors

  • Ansible Core