ansible.builtin.uri test – is the string a valid URI
Note
This test plugin is part of ansible-core
and included in all Ansible installations. In most cases, you can use the short plugin name uri
. However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.uri
for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same test plugin name.
New in ansible-core 2.14
Synopsis
- Validates that the input string conforms to the URI standard, optionally that is also in the list of schemas provided.
Input
This describes the input of the test, the value before is ansible.builtin.uri
or is not ansible.builtin.uri
.
Parameter | Comments |
---|---|
Input string / required | Possible URI. |
Keyword parameters
This describes keyword parameters of the test. These are the values key1=value1
, key2=value2
and so on in the following examples: input is ansible.builtin.uri(key1=value1, key2=value2, ...)
and input is not ansible.builtin.uri(key1=value1, key2=value2, ...)
Parameter | Comments |
---|---|
schemes list / elements=string | Subset of URI schemas to validate against, otherwise 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 Value
Key | Description |
---|---|
Return value boolean | Returns Returned: success |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_test.html