uri¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in version2.14.
Synopsis¶
- Validates that the input string conforms to the URI standard, optionally that is also in the list of schemas provided.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input string required |
Possible URI. | |
| schemes list / elements=string |
Subset of URI schemas to validate against, otherwise B(any) scheme is considered valid. |
Examples¶
# URLs are URIs
{{ 'http://example.com' is uri }}
# but not all URIs are URLs
{{ 'mailto://nowone@example.com' is uri }}
# looking only for file transfers URIs
{{ 'mailto://nowone@example.com' is not uri(schemes=['ftp', 'ftps', 'sftp', 'file']) }}
# make sure URL conforms to the 'special schemas'
{{ 'http://nobody:secret@example.com' is uri(['ftp', 'ftps', 'http', 'https', 'ws', 'wss']) }}
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | boolean | Returns V(false) if the string is not a URI or the schema extracted does not match the supplied list. |
Authors¶
- Ansible Core